Chaz Brangwin
Chaz Brangwin

Reputation: 51

Test drive on flutter: android.jar file not found

I'm just trying to run the first app and this is what happens:

FAILURE: Build failed with an exception.

BUILD FAILED in 15s Gradle task assembleDebug failed with exit code 1 Exited (sigterm)

The file is on the android-29 folder! what should I do?

Upvotes: 5

Views: 6715

Answers (5)

Karthikeya Narla
Karthikeya Narla

Reputation: 1

In my case, the problem was solved using the following steps.

  1. JDK is not installed on my machine; I have installed it.
  2. After I faced the issue, android.jar was not found in the android-33 folder. I deleted the android-33 and The app started working.

Upvotes: 0

Brylie Christopher Oxley
Brylie Christopher Oxley

Reputation: 1862

For some reason, android.jar is't automatically downloaded or built when installing specific Android SDK versions. This oversight means Flutter cannot find the android.jar, since it doesn't exist.

One solution, after installing the SDK version, is to manually download the android.jar for your desired SDK version from the following GitHub repository:

https://github.com/Sable/android-platforms

Make sure to put the android.jar file in the correct location, replacing XX with your version number:

Windows

C:\Users\XXXX\Appdata\Local\Android\sdk\platforms\android-XX\android.jar

OS X

Users/<username>/Library/Android/sdk/platforms/android-XX/android.jar

Upvotes: 1

Linh
Linh

Reputation: 60923

Not only android.jar is missing from my android-xx folder, then copy android.jar from other folder could solve this problem but I still have another problems when combine.
So I do a workaround

  • First, I delete this android-xx folder from Android\sdk\platforms
  • Then, I create a new empty project
  • Next, inside app\build.gradle of new project, I set both compileSdk and targetSdk to xx
  • Sync and run new project
  • Finally, android-xx will contains all the files

I dont know if delete the old android-xx before create new project is required or not. but I deleted it to make sure their is no other problem when replacing file

Upvotes: 0

Thenujan Sandramohan
Thenujan Sandramohan

Reputation: 179

This error might occur because of android.jar is in another folder

Try opening

C:\Users\XXXX\Appdata\Local\Android\sdk\platforms

and then look for a folder named android-29 or android-27 and you should be able to find android.jar in that folder just copy that file and paste it into to android-28

Upvotes: 3

Faisal Ahmed
Faisal Ahmed

Reputation: 21

Image Please update your android sdk.

You don't have install api 28. Please open your android sdk and install android sdk 28.

Upvotes: 2

Related Questions