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 :
- AS's File menu -> Project Structure option: then SDK Location. Set the location of the specified jdk.
Gradle's configuration specifies jdk:
- window: Find the file gradle.properties under the path of C:\Users\username\.gradle (if not, create a gradle.properties file)
- 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.