Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
450 views
in Technique[技术] by (71.8m points)

New Android studio 4.2 Preview having this error when creating buildSrc and build.gradle.kts

I am trying to use buildSrc for dependency management in the new Android 4.2 Preview version and getting this error.

Cannot access 'java.lang.Object' which is a supertype of 'org.gradle.api.artifacts.repositories.MavenArtifactRepository'. Check your module classpath for missing or conflicting dependencies
Cannot access class 'java.net.URI'. Check your module classpath for missing or conflicting dependencies

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I figured it out, it's due to the Java default JDK coming with the new Android Studio, I believe this will be fixed in the release version.

To quickly fix this there are two options:

  1. Use the JDK of the previous release Android Studio if you have not deleted it (recommended because I tested that).
  2. Download Java JDK and install it and get it's directory and attach it to JDK directory in the new Android studio.

How to change the JDK in Android studio.

  1. File ->
  2. Project Structure ->
  3. On the left find "SDK Location" ->
  4. at the bottom you will find "JDK Location" change this to the same directory either of the old Android studio or the location of Java JDK that you installed manually from Oracle official website.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...