I am trying to build app in App Center. Build.gradle
buildscript {
ext.kotlin_version = "1.5.30"
repositories {
google()
mavenCentral()
mavenLocal()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.bugsnag:bugsnag-android-gradle-plugin:7.0.0"
}
}
App build.gradle
apply plugin: "com.android.application"
apply plugin: "kotlin-android"
android {
compileSdkVersion 30
ndkVersion "17.2.4988734"
defaultConfig {
applicationId "com.example.bugsnag.android"
minSdkVersion 14
targetSdkVersion 30
versionCode 1
versionName "1.0"
}
signingConfigs {
config {
keyAlias "password"
keyPassword "password"
storeFile file("../fakekeys.jks")
storePassword "password"
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
signingConfig signingConfigs.config
}
}
externalNativeBuild.cmake.path "CMakeLists.txt"
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
}
}
dependencies {
implementation "com.bugsnag:bugsnag-android:5.12.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "androidx.appcompat:appcompat:1.3.1"
implementation "com.google.android.material:material:1.4.0"
}
apply plugin: "com.bugsnag.android.gradle"
bugsnag.failOnUploadError = false
Why is JAVA 11 not detected? How to test this?
I am not sure if my ANdroid Studio has JAVA 11,image below shows Moules for my Project

It shows

Gradle properties

App Center build log
> Failed to apply plugin 'com.android.internal.application'.
> Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.
How to edit gradle.properties? org.gradle.java.home = WHAT?
If JDK 11 is resolved,why build fails?
Two solutions for your problem:
In the gradle.properties file at the project level, you can add a property called org.gradle.java.home=C:\\Program Files\\Java\\jdk11.0.0 (Don't add quotation marks before or after the path)
Put JDK 11 path in your PATH environment variable, and remove all other JDKs from it.
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