-
QuestionPreviously (20245/15) I wrote a program that could be packaged into an apk file normally, but today (2024/6/2) after I rewrote part of the program code, I could not package it into an apk file. During this period, I Did you miss something? The error message is as follows Code sampleNo response Error messageBuilding .apk for Android...Resolving dependencies...
audioplayers 5.2.1 (6.0.0 available)
audioplayers_android 4.0.3 (5.0.0 available)
audioplayers_darwin 5.0.2 (6.0.0 available)
audioplayers_linux 3.1.0 (4.0.0 available)
audioplayers_platform_interface 6.1.0 (7.0.0 available)
audioplayers_web 4.1.0 (5.0.0 available)
audioplayers_windows 3.1.0 (4.0.0 available)
fl_chart 0.65.0 (0.68.0 available)
flutter_lints 2.0.3 (4.0.0 available)
flutter_markdown 0.6.23 (0.7.1 available)
flutter_native_splash 2.3.7 (2.4.0 available)
flutter_plugin_android_lifecycle 2.0.19 (2.0.20 available)
intl 0.18.1 (0.19.0 available)
js 0.6.7 (0.7.1 available)
leak_tracker 10.0.0 (10.0.5 available)
leak_tracker_flutter_testing 2.0.1 (3.0.5 available)
leak_tracker_testing 2.0.1 (3.0.1 available)
lints 2.1.1 (4.0.0 available)
material_color_utilities 0.8.0 (0.11.1 available)
meta 1.11.0 (1.15.0 available)
package_info_plus 4.2.0 (8.0.0 available)
package_info_plus_platform_interface 2.0.1 (3.0.0 available)
path_provider_android 2.2.4 (2.2.5 available)
petitparser 5.4.0 (6.0.2 available)
record_web 1.1.0 (1.1.1 available)
sensors_plus 4.0.2 (5.0.1 available)
shared_preferences_android 2.2.2 (2.2.3 available)
test_api 0.6.1 (0.7.1 available)
toml 0.14.0 (0.15.0 available)
url_launcher_android 6.3.2 (6.3.3 available)
vm_service 13.0.0 (14.2.3 available)
web_socket_channel 2.4.5 (3.0.0 available)
win32 5.5.0 (5.5.1 available)
xml 6.3.0 (6.5.0 available)
Got dependencies!
34 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.
Running Gradle task 'assembleRelease'...
Font asset "CupertinoIcons.ttf" was tree-shaken, reducing it from 257628 to 209160 bytes (18.8% reduction). Tree-shaking
can be disabled by providing the --no-tree-shake-icons flag when building your app.
Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 1261080 bytes (23.3% reduction).
Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Running Gradle task 'assembleRelease'... 175.5s
┌─ Flutter Fix ─────────────────────────────────────────────────────────────────────────────────┐
│ The plugin record_android requires a higher Android SDK version. │
│ Fix this issue by adding the following to the file │
│ C:\Users\jkloi\AppData\Local\Temp\flet_flutter_build_U4xCBwCn1Y\android\app\build.gradle: │
│ android { │
│ defaultConfig { │
│ minSdkVersion 23 │
│ } │
│ } │
│ │
│ Following this change, your app will not be available to users running Android SDKs below 23. │
│ Consider searching for a version of this plugin that supports these lower versions of the │
│ Android SDK instead. │
│ For more information, see: │
│ https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration │
└───────────────────────────────────────────────────────────────────────────────────────────────┘
C:\Users\jkloi\AppData\Local\Android\Sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\bin\llvm-strip.exe:
error:
'C:\Users\jkloi\AppData\Local\Temp\flet_flutter_build_U4xCBwCn1Y\build\serious_python_android\intermediates\merged_nativ
e_libs\release\out\lib\armeabi-v7a\libpythonbundle.so': The file was not recognized as a valid object file
C:\Users\jkloi\AppData\Local\Android\Sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\bin\llvm-strip.exe:
error:
'C:\Users\jkloi\AppData\Local\Temp\flet_flutter_build_U4xCBwCn1Y\build\serious_python_android\intermediates\merged_nativ
e_libs\release\out\lib\arm64-v8a\libpythonbundle.so': The file was not recognized as a valid object file
C:\Users\jkloi\AppData\Local\Android\Sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\bin\llvm-strip.exe:
error:
'C:\Users\jkloi\AppData\Local\Temp\flet_flutter_build_U4xCBwCn1Y\build\serious_python_android\intermediates\merged_nativ
e_libs\release\out\lib\x86_64\libpythonbundle.so': The file was not recognized as a valid object file
C:\Users\jkloi\AppData\Local\Temp\flet_flutter_build_U4xCBwCn1Y\android\app\src\main\AndroidManifest.xml Error:
uses-sdk:minSdkVersion 21 cannot be smaller than version 23 declared in library [:record_android]
C:\Users\jkloi\AppData\Local\Temp\flet_flutter_build_U4xCBwCn1Y\build\record_android\intermediates\merged_manifest\relea
se\AndroidManifest.xml as the library might be using APIs not available in 21
Suggestion: use a compatible library with a minSdk of at most 21,
or increase this project's minSdk version to at least 23,
or use tools:overrideLibrary="com.llfbandit.record" to force usage (may lead to runtime failures)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processReleaseMainManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 21 cannot be smaller than version 23 declared in library
[:record_android]
C:\Users\jkloi\AppData\Local\Temp\flet_flutter_build_U4xCBwCn1Y\build\record_android\intermediates\merged_manifest\relea
se\AndroidManifest.xml as the library might be using APIs not available in 21
Suggestion: use a compatible library with a minSdk of at most 21,
or increase this project's minSdk version to at least 23,
or use tools:overrideLibrary="com.llfbandit.record" to force usage (may lead to runtime failures)
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2m 54s
Gradle task assembleRelease failed with exit code 1
Error building Flet app - see the log of failed command above. ------------------------------------------------------
|
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 3 replies
-
In my mind, I had encountered this problem before, and later "FeodorFitsner" helped to solve it. |
Beta Was this translation helpful? Give feedback.
-
I just tested again, and the result is that the program cannot be packaged into an apk. |
Beta Was this translation helpful? Give feedback.
-
Haven't compiled apk in awhile and yeah I saw 2 things broken with recent updates, first is one your talking about, second is that |
Beta Was this translation helpful? Give feedback.
-
I solved your problem by using --template option and changing pubspec.yaml to latest flet version, and changing android\app\build.gradle |
Beta Was this translation helpful? Give feedback.
-
Ok that was actually a bad solution, I used main branch instead of 0.22.1 branch. While it did compile under main, flet_video did not work on android using it. When I checked out 0.22.1 branch and changed minSdkVersion version to 23 I started getting errors:
|
Beta Was this translation helpful? Give feedback.
-
Alright after reading over record pub.dev etc pages, they moved the minimum sdk to 23, I think the only way to really solve this is force going back to versions using sdk 21 till flet team can make minsdk 23 for record work, so solution is as follows: edit pubspec.yaml and add following to fix record_audio and video on flet version 0.21.1:
This now compiles to apk fine for both video and record_audio without issues.... |
Beta Was this translation helpful? Give feedback.
-
syleishere, I am still unable to successfully create the APK file. I think I might have made a mistake in the "pubspec.yaml" file. Could you tell me the correct file path for "pubspec.yaml"? Or do I need to add some parameters to the "flet build apk --include-packages flet_audio flet_audio_recorder" command? Please provide guidance. |
Beta Was this translation helpful? Give feedback.
-
my compilation message: Running Gradle task 'assembleRelease'... C:\Users\jkloi\AppData\Local\Android\Sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\bin\llvm-strip.exe: error: C:\Users\jkloi\AppData\Local\Android\Sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\bin\llvm-strip.exe: error: C:\Users\jkloi\AppData\Local\Android\Sdk\ndk\23.1.7779620\toolchains\llvm\prebuilt\windows-x86_64\bin\llvm-strip.exe: error: Dart snapshot generator failed with exit code -1073740940 FAILURE: Build failed with an exception.
BUILD FAILED in 2m 58s Error building Flet app - see the log of failed command above. |
Beta Was this translation helpful? Give feedback.
-
I shall
|
Beta Was this translation helpful? Give feedback.
-
i have problem i success build apk with flutter and android studio is installed in pc .
how to solve . version
|
Beta Was this translation helpful? Give feedback.
I shall
After following the above steps, the program can be successfully packaged as an apk file and installed on the tablet.
Friends in need can refer to the above steps to handle it.
However, some of the functions that I could execute before are now unavailable and are being debugged.