Generate signed apk fails with build\app\intermediates\flutter\profile\libs.jar (The system cannot find the path specified)

13,749

Solution 1

I found a fix for this issue as I was searching through various issues people had reported on github regarding this.

This is just a workaround.

You can get two kinds of error. For me the system could not find profile/libs.jar, for some people the error was for debug/libs.jar. If the issue is profile, you should first run your app in profile mode and then Generate signed apk (or build and run in release mode). To run in profile mode use flutter run --profile. There is also a profile option under Run menu in Android Studio.

If the error is about debug/libs.jar, first build the debug version (and also the profile mode) and then try to Generate signed apk. By default, flutter run compiles to debug mode.

This issue evidently arises from the updated Gradle and android studio gradle plugin.

Here is the workaround by Jwiggiff on the github page.

Solution 2

This problem is with latest gradle 4.0.0

Switch from classpath 'com.android.tools.build:gradle:4.0.0'

to classpath 'com.android.tools.build:gradle:3.6.3'

or classpath 'com.android.tools.build:gradle:3.5.0' (Worked for me)

Solution 3

If you don't care about lintOptions you can add this code in app's build.gradle file:

android {
    lintOptions { 
        checkReleaseBuilds false
        abortOnError false
    }
}

Solution 4

this will work.

flutter build apk --debug && flutter build apk --profile && flutter build apk --release

but test the apk before sharing it.

even it doesn't work the change the gradle from 4.x to 3.6.x this will work.

Solution 5

This should also work fine

flutter build apk --profile
Share:
13,749
GunJack
Author by

GunJack

I don't worry about life as I know, I am not going to survive it anyways.

Updated on June 05, 2022

Comments

  • GunJack
    GunJack almost 2 years

    I am on android studio 4. Gradle is 6.1.1. And I created a new flutter project from android studio. Then I opened the project as an android project. There is such an option in Tools->Flutter. Which resulted in gradle sync. That was successful. But when I try to generate signed apk with my keys. I get this. error

    \path\to\my\project\build\app\intermediates\flutter\profile\libs.jar (The system cannot find the path specified)
    

    There is no profile directory at the given location. But there are Debug and Release directories both of which contains libs.jar. I searched all other the net for this issue. Found Nothing.

    Additional: I can build debug apk with no issues.