Description
Canonical Issue
https://issuetracker.google.com/issues/141126614
Steps to Reproduce
- Run
flutter create counter
- Update the app to use Android Gradle plugin 4.0.0
- Run
flutter build apk
Logs
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:debugRuntimeClasspath'.
> 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/michaelbui/Projects/counter/build/app/intermediates/flutter/debug/libs.jar.
> Failed to transform '/Users/michaelbui/Projects/counter/build/app/intermediates/flutter/debug/libs.jar' using Jetifier. Reason: FileNotFoundException, message: /Users/michaelbui/Projects/counter/build/app/intermediates/flutter/debug/libs.jar (No such file or directory). (Run with --stacktrace for more details.)
Please file a bug at http://issuetracker.google.com/issues/new?component=460323.
* 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
[✓] Flutter (Channel stable, v1.17.2, on Mac OS X 10.15.5 19F96, locale en-AU)
• Flutter version 1.17.2 at /Users/michaelbui/flutter
• Framework revision 5f21edf8b6 (20 hours ago), 2020-05-28 12:44:12 -0700
• Engine revision b851c71829
• Dart version 2.8.3
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/michaelbui/Library/Android/sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.5, Build version 11E608c
• CocoaPods version 1.9.1
[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 45.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6222593)
[✓] VS Code (version 1.45.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.10.2
Edit: created an issue against the Jetifier component as suggested by Gradle output https://issuetracker.google.com/u/1/issues/157728192
Metadata
Metadata
Assignees
Labels
High-priority issues at the top of the work listStack traces logged to the consoleIt was better in the past than it is nowAffects or could affect many people, though not necessarily a specific customer.Android team may need to help usFound to occur in 1.21The issue has been confirmed reproducible and is ready to work onAndroid applications specifically"flutter build" and "flutter run" on AndroidAffects the "flutter" command-line tool. See also t: labels.
Activity
Zazo032 commentedon May 29, 2020
Building apk also crashes for me. However, building appbundle works.
Running with
--release
also crashes, but if you run--debug
and then--release
, it does seem to work (weird one). After succesfully running with--release
, you'll be able tobuild apk
.jason-simmons commentedon May 30, 2020
The Android Gradle
LintPerVariantTask
now appears to be adding JARs from all build variants to its inputs:https://android.googlesource.com/platform/tools/base/+/1f9787310d64a66370627a2aaefa1e616565c17d
The
libapp.so
libraries containing the app's compiled Dart code are packaged in a JAR, and a different JAR is generated for each variant. I'm not sure how dynamically generated per-variant JARs are supposed to be handled if the lint task expects all variants' JARs to be available.As a hack workaround you could change the
lintOptions
inapp/build.gradle
to disable the lint task:@blasten
newbieflutter commentedon May 31, 2020
Hi,
It also fails on my side I tried first --debug then --release it fails. I tried checkReleaseBuilds false but many plugin fails like shared_preferences, maps etc all fail to work. What is the best solution ?
sgehrman commentedon May 31, 2020
Malik056 commentedon May 31, 2020
Same here. Recently updated android studio, android sdk, gradle and flutter, And I no longer able to build release apk
newbieflutter commentedon May 31, 2020
Hi,
Looks like this is a big issue then. I upgrade all too. Any one found any solution?
Jwiggiff commentedon May 31, 2020
I wouldn't consider this a solution, but I've found a workaround. I was having the same issue and tried building
--debug
and then--release
and it still didn't work. However, if you look at the path in your specific error, it should either end withdebug/libs.jar
orprofile/libs.jar
. This indicates which apk you need to build first. In OP's case it isdebug/libs.jar
so building--debug
first and then--release
worked. In my case, it wasprofile/libs.jar
so building--profile
and then--release
worked. I'm pretty sure building the--release
shouldn't have to access thedebug
orprofile
directories though.TL;DR
If your error says
debug/libs.jar
, build--debug
then--release
.If your error says
profile/libs.jar
, build--profile
then--release
.Malik056 commentedon May 31, 2020
I downgraded the android gradle and gradle version, from Android studio Project Structure. And Clean build my project. now it is working.
amelnikov78 commentedon Jun 1, 2020
@Jwiggiff
That works, thanks!
191 remaining items