While you run command "Flutter run", you may get an error "platforms/android-29/android.jar' specified for property 'androidJar' does not exist.". This error is occurring because android.jar file is not there. See the example below to solve this issue.
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':app:processDebugResources'.
> File '/home/username/Android/Sdk/platforms/android-29/android.jar' specified for property 'androidJar' does not exist.
* 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
See the steps below to solve this issue.
Step 1: Check compileSdkVerion value at "android/app/src/build.gradle" file.
android {
compileSdkVersion 29
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
}
Here is "29" on our project, which means, the compiler will use SKD Platform version 29 (Android Q Version). Check if you have installed this version of the platform or not on SDK Manager. This is the reason the path looks like 'android-29/android.jar'.
Here, API Level 29 is already installed, if your compileSdkVersion is different, then install SDK platform with the same API Level.
Step 2: Try to run "flutter run" again, if it still shows an error then follow the steps below:
Now, check the path, and confirm if there is "android.jar" file is in the location. This error causes due to missing this file, so you will not find it.
Go to https://github.com/Sable/android-platforms and choose the SDK platform, and open the folder, you will see "android.jar" file, download it and paste it to the path of your SDK platform.
Now, after pasting the file to its location on your local computer. Try to run "flutter run", your project will be compiled.
In this way, you can solve the missing "android.jar" file in SDK platform while compiling.
Please Wait...
No any Comments on this Article