I am trying to build apk but firebase admob is making problem, if I run without firebase_admob then apk works perfectly and built without any error how to resolve that issue?
I am getting this error :
Execution failed for task ':firebase_admob:verifyReleaseResources' in this case.
I am using firebase_admob: ^0.5.2 this version of it I even try some latest versions but the problem is still there.
C:\Users\Waqas\AndroidStudioProjects\gtvsports1>flutter build apk
You are building a fat APK that includes binaries for android-arm, android-arm64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
To generate an app bundle, run:
flutter build appbundle --target-platform android-arm,android-arm64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk --target-platform android-arm,android-arm64 --split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Initializing gradle... 1.3s
Resolving dependencies... 4.7s
Running Gradle task 'assembleRelease'...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':firebase_admob:verifyReleaseResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
C:\Users\Waqas\AndroidStudioProjects\gtvsports1\build\firebase_admob\intermediates\res\merged\release\values\values.xml:304: error: resource android:attr/fontVariationSettings not foun
d.
C:\Users\Waqas\AndroidStudioProjects\gtvsports1\build\firebase_admob\intermediates\res\merged\release\values\values.xml:305: error: resource android:attr/ttcIndex not found.
error: failed linking references.
* 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 3m 10s
Running Gradle task 'assembleRelease'... 190.9s (!)
Gradle task assembleRelease failed with exit code 1
I was facing similar error. but I would like to suggest you to make appbundle which is the best option to upload app. Run flutter build appbundle sign it with google play store signing enrollment and upload. I resolve it with this.
Seems like you haven't migrated your project to AndroidX, all you need to do is, in your IDE use
Refactor > Migrate to AndroidX
After this
File > Invalidate Caches and Restart
Did you add the dependencies in Android/app/build.gradle?
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
api 'com.google.firebase:firebase-core:16.0.9'
api 'com.google.firebase:firebase-ads:16.0.1'
}
Related
I am getting an error stating that it "Failed to transform libs.jar to match attributes" because "Transform's input file does not exist". This happened while building a release APK in Flutter.
How do I fix this?
mianumararshad#Mians-MacBook-Pro driverSide % flutter build apk --release
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
To generate an app bundle, run:
flutter build appbundle --target-platform android-arm,android-arm64,android-x64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Running Gradle task 'assembleRelease'... Note: /Users/mianumararshad/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.13.7/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /Users/mianumararshad/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/geolocator-5.3.2+2/android/src/main/java/com/baseflow/geolocator/tasks/LocationUpdatesUsingLocationManagerTask.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:profileRuntimeClasspath'.
> Failed to transform libs.jar to match attributes {artifactType=processed-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: /Users/mianumararshad/Downloads/flutter project/roudy/driverSide/build/app/intermediates/flutter/profile/libs.jar.
> Transform's input file does not exist: /Users/mianumararshad/Downloads/flutter project/roudy/driverSide/build/app/intermediates/flutter/profile/libs.jar. (See https://issuetracker.google.com/issues/158753935)
* 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 6m 25s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 387.5s (!)
Step 1. flutter build apk --debug
Step 2. flutter build apk --profile
Step 3. flutter build apk --release
I have upgraded my gradle build tools 3.5.0 -> 4.0.1. After that I was not able to make release apk. Looks like upgrading gradle build tools broke some lints.
Below solution worked for me
Go in android folder->app->open build.gradle fine Search for lintOptions and add checkReleaseBuilds false example:
lintOptions {
disable 'InvalidPackage'
checkReleaseBuilds false //Insert this line
}
}
TYSONs-MacBook-Air:chats jeshurun$ flutter build apk --release
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
To generate an app bundle, run:
flutter build appbundle --target-platform android-arm,android-arm64,android-x64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Plugin project :firebase_core_web not found. Please update settings.gradle.
Plugin project :cloud_firestore_web not found. Please update settings.gradle.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':device_info: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/jeshurun/.gradle/caches/transforms-2/files-2.1/8caf43a43008a17794fe6e0dd5ac61b7/core-1.1.0/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/fontVariationSettings not found.
/Users/jeshurun/.gradle/caches/transforms-2/files-2.1/8caf43a43008a17794fe6e0dd5ac61b7/core-1.1.0/res/values/values.xml:142:5-173: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 14s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 15.6s
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 agora_rtc_engine...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 1.7s
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':compileReleaseAidl'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/jeshurun/flutter/.pub-cache/hosted/pub.dartlang.org/agora_rtc_engine-1.0.12/android/local.properties'.
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 1s
The plugin agora_rtc_engine could not be built due to the issue above.
First, flutter build apk by default uses argument --release.
Next, May be you are using AndroidX packages within your app but your app not migrated to use AndroidX. To ensure that:
In an app or module project, the file android/gradle.properties or .android/gradle.properties must contain:
android.useAndroidX=true
android.enableJetifier=true
Or else maybe because your compileSdkVersion is lower than 28,
Try setting compileSdkVersion 28 or 29 to app/build.gradle. If this not solved your problem may be one of your plugin is the problem. Ofcourse you can edit your plugin build gradle but I do not recommend that.
First, Try upgrading packages that are not updated. If not upgarded those packages, you can follow below by opening flutter root android directory in android studio.
Steps:
Go to External libraries
Locate the library that raised the issue
Open it's app/build.gradle
Update the compileSdkVersion to 28 or 29
Also you can cloned the packages that causes the problem and do aboves and push it to github and in the pubspec.yaml, access from github like below:
dependencies:
#...
repo_name:
git:
url: git://github.com/your_github/repo_name.git
If none of them worked, worth trying below options :D,
Flutter clean / Deleted build folder
Deleted pubspec.lock, .packages, .flutter-plugins
Flutter pub cache repair
Ensured compileSdkVersion is 28 in app/build.gradle
finally, try Deleting flutter/.pub-cache
In android build.gradle file try to change the compileSdkVersion to: compileSdkVersion 28
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.
francis#homelaptop:~/project/flybird$ flutter build apk
You are building a fat APK that includes binaries for android-arm, android-arm64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
To generate an app bundle, run:
flutter build appbundle --target-platform android-arm,android-arm64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk --target-platform android-arm,android-arm64 --split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Initializing gradle... 45.2s
Resolving dependencies...
Error running Gradle:
ProcessException: Process "/home/francis/project/flybird/android/gradlew" exited abnormally:
FAILURE: Build failed with an exception.
Where:
Build file '/home/francis/project/flybird/android/build.gradle' line: 24
What went wrong:
A problem occurred evaluating root project 'android'.
A problem occurred configuring project ':app'.
java.nio.file.FileSystemException: /home/francis/.PlayOnLinux/wineprefix/default/dosdevices/z:/media/francis/Interesante/.Trash-1000/files:
Input/output error
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 3m 10s
Command: /home/francis/project/flybird/android/gradlew app:properties
Please review your Gradle project setup in the android/ folder.
Update your gradle version from project => android => build. For me :
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
}
Use latest sdk tool version 28 not 29
Open terminal from Tools >>Flutter and run these following commands
flutter upgrade
flutter doctor
When I update my package to image_picker: ^0.6.0+9 getting build error.
I have already migrate Android X.
Error:
Launching lib/main.dart on vivo V3 in debug mode...
Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDebug'...
D8: Program type already present: android.support.v4.media.MediaBrowserCompat$CustomActionCallback
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.media.MediaBrowserCompat$CustomActionCallback
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 2s
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
Finished with error: Gradle task assembleDebug failed with exit code 1
Make Sure to follow the guide to support AndroidX
https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility
For Solving Dex error
Try adding this line In your Project folder > android > app > build.gradle
add the following Line in multiDexEnabled true
inside defaultConfig
Use flutter clean command once it is done then try running your app.
Add following line in gradle.properties
android.useAndroidX=true
android.enableJetifier=true
Remove Simple Permission package.
it's because your app isn't compatible with AndroidX ,
There are 2 solution
1-create a flutter compatible with AndroidX app by using this command in your terminal
flutter create --androidx [project_name]
2-configure your app manually
Its not problem with the Image provider its something to do with the latest flutter package. To resolve this issue
Open the Android folder of your your flutter project in Android Studio
Wait for the gradle to build once the task is complete click on Refactor -> Refactor this -> Migrate to AndroidX or press Ctrl+T -> Migrate to AndroidX
Do flutter clean
And boom your good to go
If you want to do manually by twicking the gradle file here is link
https://flutter.dev/docs/development/androidx-migration
Happy Hacking