Flutter: Cannot determine path to 'tools.jar' library for Android API 30 Platform (C:/Users/Sam/AppData/Local/Android/Sdk)

7,073

After mucking around I think I have found the solution. I did not have JDK 1.8 on my machine but jdk 1.16. But that is no good because we need JDK1.16 does not include tools.jar. So:

  1. Install Oracle's JDK 1.8 on your machine if you don't have it.
  2. Go to your Android Studio and do this:
  3. Select the root node of your project and then use File->Project Structure
  4. Under Platform Settings / SDKs, use the + Icon to "Add JDK" and add the newly installed JDK 1.8 here. C:\Program Files\Java\jdk1.8.0_311
  5. Crucial Step : After adding this JDK, in the same screen i.e. Platform Settings/SDKs, click on Android API 31 Platform. Here, in the JAVA SDK field, drop down the options and select 1.8. If you don't see 1.8 here, restart Android Studio and/or add C:\Program Files\Java\jdk1.8.0_311 to JAVA_HOME

That's is what fixed it for me.

Share:
7,073
Sam
Author by

Sam

Updated on January 02, 2023

Comments

  • Sam
    Sam over 1 year

    I'm having difficulty uploading my upgraded project to Google Play.

    I need to produce a signed version of the app, but if I try App bundle it complains I have an obsolete Gradle plugin, that I can't upgrade. I have a bleeding edge gradle version in my gradle-wrapper.properties:

    distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip

    So I try to create a signed apk and give it a keystore, but when it tries to output the app it throws this complaint:

    Cannot determine path to 'tools.jar' library for Android API 30 Platform (C:/Users/Sam/AppData/Local/Android/Sdk)

    1. I've tried the existing answers, setting a JAVA_HOME under advanced system variables, that didn't work.
    2. I copied tools.jar from my java directory to C:/Users/Sam/AppData/Local/Android/Sdk, that didn't work.

    I'm knashing my teeth.

    • Priyshrm
      Priyshrm over 2 years
      Did you find a solution?