Issue
I’m trying to integrate Jetpack Compose in my project with Android Studio 4.2 and I am getting the following error in the IDE:
Invalid Gradle JDK configuration found. Open Gradle Settings
I also checked the settings below:
- Android gradle plugin version: 4.2.0-alpha01
- Gradle version: 6.5-rc-1
app/build.gradle:
composeOptions {
kotlinCompilerVersion "1.3.70-dev-withExperimentalGoogleExtensions-20200424"
kotlinCompilerExtensionVersion "0.1.0-dev13"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
buildFeatures {
compose true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
Any idea?
Solution
The IDE seems to use a value defined in the .idea/gradle.xml
file in your project.
If in that file, you have something like the following:
<option name="gradleJvm" value="12.0.1" />
try replacing it with that instead:
<option name="gradleJvm" value="1.8" />
EDIT: This was a bug in Android Studio 4.1 canary/beta that got fixed in 4.1 beta 2.
Answered By – Louis CAD
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0