How to fix the following error?
android {
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
...
}
Android Studio --> File --> Project Structure --> Modules --> Unresolved reference: JavaVersion.VERSION_1_8
I added to the buildscript
section of the root build.gradle
the ext.java_version
variable
buildscript {
...
ext.java_version = JavaVersion.VERSION_1_8
...
}
and changed in the module's build.gradle
JavaVersion.VERSION_1_8
to java_version
android {
...
compileOptions {
sourceCompatibility java_version
targetCompatibility java_version
}
...
}
Now it's all work fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With