SerNet OE
SerNet OE

Reputation: 157

Fail when build flutter apk

I update my flutter SDK, I add AndroidX, and also apply Migrating steps I can run my project without any problem. But when I try to build my project I get the error below.

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
Running Gradle task 'assembleRelease'...
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked 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: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: C:\oeu\pr\Flutter\projectname\build\app\intermediates\flutter\debug\libs.jar.
         > Transform's input file does not exist: C:\oeu\pr\Flutter\projectname\build\app\intermediates\flutter\debug\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 2m 30s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done                     151,5s (!)
Gradle task assembleRelease failed with exit code 1

Here is my flutter doctor -v

[√] Flutter (Channel stable, 1.22.5, on Microsoft Windows [Version 10.0.18363.1256], locale tr-TR)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[!] Android Studio (version 4.1.0)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.51.1)
[√] Connected device (1 available)

Upvotes: 1

Views: 761

Answers (2)

jeugene
jeugene

Reputation: 231

From the flutter doctor it seems you are missing the Flutter and Dart plugin. Either it might have been deleted or, the location changed accidentally. Try reinstalling the same. Would solve the issue

Upvotes: 0

Onur Ege Unaldi
Onur Ege Unaldi

Reputation: 185

If you update the Dart SDK follow these steps to build apk, If your error says debug/libs.jar, build --debug then --release. If your error says profile/libs.jar, build --profile then --release. Then you can run flutter build apk --relase or flutter build apk Highly recommend that to read this answer.

Upvotes: 1

Related Questions