Ubuntu和Win下:Android Studio and Gradle are using different locations forthe JDK

Under Ubuntu: When AS compiles the app, the Event Log prompts: Android Studio and Gradle are using different locations for the JDK

 

Android Studio configuration jdk :

  1. AS's File menu -> Project Structure option: then SDK Location. Set the location of the specified jdk.

 

Gradle's configuration specifies jdk:

  1. window: Find the file gradle.properties under the path of C:\Users\username\.gradle (if not, create a gradle.properties file)
  2. linux: hidden files in the home directory, .gradle/gradle.properties


Open gradle.properties and add a sentence at the end: org.gradle.java.home=your jdk path. (If so, directly modify the path of jdk).

Note: under win, an escape character is required, org.gradle.java.home=D:\\Program Files\\Java\\jdk1.8.0_241

 

Then restart Android Studio again.

 

 

Guess you like

Origin blog.csdn.net/chungehenyy/article/details/105471799