C:\Users\i\Desktop\New folder\Covid-19-Flutter-UI-master>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
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\i\Desktop\New folder\Covid-19-Flutter-UI-master\android\app\build.grad
le' line: 50
* What went wrong:
Could not compile build file 'C:\Users\i\Desktop\New folder\Covid-19-Flutter-UI-master\andr
oid\app\build.gradle'.
> startup failed:
build file 'C:\Users\i\Desktop\New folder\Covid-19-Flutter-UI-master\android\app\build.gr
adle': 50: expecting anything but ''\n''; got it anyway # line 50, column 15.
" }
^
1 error
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to g
et more log output. Run with --scan to get full insights.
Gradle task assembleRelease failed with exit code 1
C:\Users\i\Desktop\New folder\Covid-19-Flutter-UI-master>
Follow all these steps: https://flutter.dev/docs/deployment/android
Flutter and Android also recommend using App bundle as preferred over APK, so try using flutter build appbundle once you have followed all the steps.
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
}
}
I am trying to build a release APK for flutter app for existing app ,when I run flutter build apk --release, I got this error
I built the app before upgrading Flutter to Channel beta (now I am using flutter to develop a website
Can anyone help me please?
Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration
':flutter_plugin_android_lifecycle:debugUnitTestRuntimeClasspath'.
> Could not download mockito-core.jar (org.mockito:mockito-core:1.10.19)
> Could not get resource 'https://jcenter.bintray.com/org/mockito/mockito-core/1.10.19/mockito-
core-1.10.19.jar'.
> Could not GET 'https://d29vzk4ow07wi7.cloudfront.net/e8546f5bef4e061d8dd73895b4e8f40e3fe6effe?
response-content-disposition=attachment%3Bfilename%3D%22mockito-core-1.10.19.jar%22&Policy=eyJTdGF0ZW1lbnQiOiBbeyJSZXNvdXJjZSI6Imh0dHAqOi8vZDI5dnprNG93MDd3aTcuY2xvdWRmcm9udC5uZXQvZTg1NDZmNWJlZjRlMDYxZDhkZDczODk1YjRlOGY0MGUzZmU2ZWZmZT9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPWF0dGFaG1lbnQlM0JmaWxlbmFtZSUzRCUyMm1vY2tpdG8tY29yZS0xLjEwLjE5LmphciUyMiIsIkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTYwMzY1NDc2MX0sIklwQWRkcmVzcyI6eyJBV1M6U291cmNlSXAiOiIwLjAuMC4wLzAifX19XX0_&Signature=lu5rAbocUI2DuLDQ79CKz2UnjGl1smkhuOD3cR~iEunjBAfYD6VYxTLZD5vuiHnmr7avMhSI96FKGjaXzKSolqEGPSieDVuXqSMaJ7HryIRL693ykuFQi-RpTgk9k6PNJLPkcWjhrlsmJzNejwr0PwXtsJytAEUhsLhIR4MPey04ryOGTn~tFLMuOzCR46bYW0Bd8yyFA~cygPipbqRHc8M-Yj2Fjp-FfAUouQTIrEEdDmh2QgtiKpyBRSSmKbUvFf9gQ5GJa13P30mjyFHuHpK8J5hexyatUSOmDFbFYta2vQR7h-dpBTlZFkh901DHQq2xVhoj-xsZI-L0HxzzA__&Key-Pair-Id=APKAIFKFWOMXM2UMTSFA'.
> d29vzk4ow07wi7.cloudfront.net
* 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 24s
Running Gradle task 'assembleRelease'... 26.7s
Gradle task assembleRelease failed with exit code 1
You can try to add checkReleaseBuilds property under lintOptions into your build.gradle file under the android/app folder. Like this:
android {
// Something else about compileSdkVersion, etc.
lintOptions {
disable 'InvalidPackage'
checkReleaseBuilds false
}
}
I tried to switch to stable, but another problem occurred, so I deleted the flutter SDK and download it again, now it is working fine.
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 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'
}
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