Open madmanleaf opened 1 month ago
Facing similar issues with 3.24 It appears the plugin needs the build.gradle and settings.gradle updated to the new flutter way of building. The exact error is: - Execution failed for task ':device_info:verifyReleaseResources'.
A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action Android resource linking failed ERROR:/Users/ian.hancock/IdeaProjects/SecureFlutter/flutter_app/build/device_info/intermediates/merged_res/release/values/values.xml:194: AAPT: error: resource android:attr/lStar not found.
This indicated it is not compatible with Android platform 31 Ad support.
I cannot reproduce the issue, the example project builds for me on Flutter 3.24.0
.
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.0, on Ubuntu 24.04 LTS 6.8.0-39-generic, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2024.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2024.2)
[✓] VS Code (version 1.92.0)
[✓] Connected device (2 available)
[✓] Network resources
Compiled using melos run build:example_android
:
└> melos exec -c 6 --fail-fast -- \
"flutter build apk --no-pub"
└> RUNNING
Select a package to run the build:example_android script:
1) * [Default - Press Enter]
2) android_alarm_manager_plus_example
3) android_intent_plus_example
4) battery_plus_example
5) connectivity_plus_example
6) device_info_plus_example
7) network_info_plus_example
8) package_info_plus_example
9) sensors_plus_example
10) share_plus_example
✔ Enter your choice 8
$ melos exec
└> flutter build apk --no-pub
└> RUNNING (in 1 packages)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
package_info_plus_example:
Running Gradle task 'assembleRelease'...
Checking the license for package Android SDK Build-Tools 34 in /home/miquel/Android/Sdk/licenses
License for package Android SDK Build-Tools 34 accepted.
Preparing "Install Android SDK Build-Tools 34 v.34.0.0".
"Install Android SDK Build-Tools 34 v.34.0.0" ready.
Installing Android SDK Build-Tools 34 in /home/miquel/Android/Sdk/build-tools/34.0.0
"Install Android SDK Build-Tools 34 v.34.0.0" complete.
"Install Android SDK Build-Tools 34 v.34.0.0" finished.
Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 1324 bytes (99.9% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Generating lint files for backported methods only (compile API B)
Running Gradle task 'assembleRelease'... 122.0s
✓ Built build/app/outputs/flutter-apk/app-release.apk (19.1MB)
package_info_plus_example: SUCCESS
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$ melos exec
└> flutter build apk --no-pub
└> SUCCESS
melos run build:example_android
└> melos exec -c 6 --fail-fast -- \
"flutter build apk --no-pub"
└> SUCCESS
OK let me strip the compile down to a simpler app and see if I can get to the bottom of it, I think something changed in the gradle build that is breaking it, maybe something missed when I upgraded our main app. I will report back after some testing
I could also build your example app just find but not any other app using the plugin. I recreated the issue with another simple plugin using your gradle files and was able to reproduce the issue again. Adding the following to the apps main build.gradle resolves the issue: -
ext { androidCore = "1.6.0" }
you can also add in your plugins build.gradle the following, which also resolves the issue: -
configurations.all { resolutionStrategy { force 'androidx.core:core:1.6.0' force 'androidx.core:core-ktx:1.6.0' } }
I could also build your example app just find but not any other app using the plugin.
I also tested on a newly created project:
$ flutter create check_build
$ cd check_build
$ flutter pub add package_info_plus
$ flutter build apk --debug
...
Running Gradle task 'assembleDebug'... 55.5s
✓ Built build/app/outputs/flutter-apk/app-debug.apk
Yeah I think it only affects projects built in older flutter versions, even when updating their Gradle builds. There is for sure some breaking change that is not documented (or at least I can't find it) with 3.24. I am doing some more digging with our own internal plugins to see if I can get to the root of it.
OK found the breaking change that does it, which is why newer apps work off the bat. Applying this to the application makes everything work: - https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply
This does not require setting android core version. Thanks for your help, it helped point me to the correct solution and fixed the 'stop using imperative build in Gradle messages that have been on my todo list for a while ;-)
Thanks for the link! I wasn't aware of it, it will come handy for people with Android compilation issues.
Platform
Android 15
Plugin
package_info_plus
Version
8.0.1
Flutter SDK
3.24.0-0.2.pre
Steps to reproduce
Unless it is not applicable, the error is always reported
Code Sample
Logs
Flutter Doctor
Checklist before submitting a bug
flutter pub upgrade
flutter clean