I am trying to build my apps in android.. when I run in debug mode, it seems ok and runs well, but when I try to flutter build apk there are error like this
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 55.6s
The build failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using
Jetifier to solve the incompatibility.
Building plugin camera...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 1,867ms
✓ Built build/app/outputs/repo.
Building plugin disk_space...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 2,303ms
✓ Built build/app/outputs/repo.
Building plugin firebase_ml_vision...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 1,132ms
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Could not resolve all files for configuration ':releaseCompileClasspath'.
> Could not resolve android.arch.lifecycle:runtime:1.1.1.
Required by:
project :
> Cannot find a version of 'android.arch.lifecycle:runtime' that satisfies the version constraints:
Dependency path 'io.flutter.plugins.firebasemlvision:firebase_ml_vision:1.0' --> 'android.arch.lifecycle:runtime:1.1.1'
is there something that I should add for configuration?
Related
[!] Gradle threw an error while downloading artifacts from the network. Retrying to download...
Exception: Gradle task assembleDebug failed with exit code 1strong text
I'm trying to implement a continuous deployment system to build my app and deploy to Google Play using codemagic. Doing a build works fine locally but fails remotely on codemagic.
Error summary:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:stripDebugDebugSymbols'.
> 1 exception was raised by workers:
org.gradle.process.internal.ExecException: A problem occurred starting process 'command '/usr/local/share/android-sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-strip''
Complete log:
== Building for Android ==
> flutter build appbundle --debug
Running "flutter pub get" in My_Project... 1,655ms
💪 Building with sound null safety 💪
Running Gradle task 'bundleDebug'...
[flutter_background_geolocation] Purging debug resources in release build
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/builder/programs/flutter_2_5_3/.pub-cache/hosted/pub.dartlang.org/geocoding-2.0.1/android/src/main/java/com/baseflow/geocoding/GeocodingPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:stripDebugDebugSymbols'.
> 1 exception was raised by workers:
org.gradle.process.internal.ExecException: A problem occurred starting process 'command '/usr/local/share/android-sdk/ndk/23.1.7779620/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-strip''
* 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 19s
Running Gradle task 'bundleDebug'... 141.1s
Gradle task bundleDebug failed with exit code 1
Build failed :|
Failed to build for Android
Current configuration on codemagic:
Flutter channel: stable
Mode: debug
Build for: Android
to fix this you need to upgrade Gradle version in android/gradle/wrapper/gradle-wrapper.properties to 6.7.1 or commit gradle wrapper to your repository if you don't have this file.
Additional to that you also might need to upgrade Android Gradle plugin in andriod/build.gradle
- classpath 'com.android.tools.build:gradle:3.5.4'
+ classpath 'com.android.tools.build:gradle:4.2.0'
WITHOUT GRADLE UPGRADE
if for some reasons you can't upgrade Gradle version you can freeze previous NDK version.
For that you can specify ndkVersion "22.1.7171670" in your build.gradle and make sure you use Java 1.8 since there is an issue with using latest Java versions.
In Codemagic you can specify Java version in environment section in your codemagic.yaml like this
workflows:
workflow-name:
environment:
ndk: r22b
java: 1.8
Please help, I'm facing problem when building realease apk file as below. I have tried searching but found only to set compileSdkVersion 28 in build.gradle file, but unlucky for my case. Any body has suggestion?
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':flutter_appavailability:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> 1 exception was raised by workers:
com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
/Users/adsavin/.gradle/caches/transforms-2/files-2.1/855694052351881cfd5b05bbd4ccb2f3/core-1.0.1/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.
/Users/adsavin/.gradle/caches/transforms-2/files-2.1/855694052351881cfd5b05bbd4ccb2f3/core-1.0.1/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcIndex not found.
* 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 1m 58s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 122.4s (!)
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the
incompatibility.
Building plugin connectivity...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 4.6s
✓ Built build/app/outputs/repo.
Building plugin connectivity_macos...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 5.3s
✓ Built build/app/outputs/repo.
Building plugin firebase_auth...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 4.8s
✓ Built build/app/outputs/repo.
Building plugin firebase_auth_web...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 4.5s
✓ Built build/app/outputs/repo.
Building plugin firebase_core...
The plugin firebase_core could not be built due to the issue above.
Running Gradle task 'assembleAarRelease'... ```
Please migrate your app in android x and if it's already done then please
check your plugin version compatible with android x
https://flutter.dev/docs/development/androidx-migration
This is what I'm receiving from Android Studio, but I don't know how to fix this in the latest version.
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.internal.version-check']
> Minimum supported Gradle version is 5.6.4.
Edit: I changed the gradle-wrapper.properties to
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
And now also went to File/Settings/Build, Execution, Deployment/Gradle, and changed the Gradle User Home to a gradle-5.6.4 that I downloaded.
But now, I'm receiving this:
Finished with error: Gradle task assembleDebug failed with exit code 1
I get this when I do 'flutter run --release'
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':unique_identifier:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
C:\Users\USER\.gradle\caches\transforms-2\files-2.1\df6cf23cc51da578d8b158de17d0c9cb\core-1.0.0\res\values\values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.
C:\Users\USER\.gradle\caches\transforms-2\files-2.1\df6cf23cc51da578d8b158de17d0c9cb\core-1.0.0\res\values\values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcIndex not found.
* 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 19s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 19.7s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin camera...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 1.7s
√ Built build\app\outputs\repo.
Building plugin cloud_firestore...
The plugin cloud_firestore could not be built due to the issue above.
When I do flutter run --debug I don't get this issue,
Any idea how to solve it?
I tried down grading cloud_firestore to 0.12.11 and 0.12.10+2 but it didn't help
I tried:
minSdkVersion 29
targetSdkVersion 29
it didn't help
I checked the file: C:\Users\USER\.gradle\caches\transforms-2\files-2.1\df6cf23cc51da578d8b158de17d0c9cb\core-1.0.0\res\values\values.xml and indeed the 2 mentioned items are missing, I try to add them manually but it is deleted when I run flutter run --release
Solution:
After I did flutter run --release --verbose, I realize that unique_identifier was refering to the package unique_identifier that I have in my YAML file but not actually uses in the project.
So I removed unique_identifier and the build passed.
The message about cloud_firestore confused me, and is not really related.