4

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 enter image description here

It shows enter image description here

Gradle properties enter image description here

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?

5

1 Answer 1

4

Two solutions for your problem:

  1. 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)

  2. Put JDK 11 path in your PATH environment variable, and remove all other JDKs from it.

3
  • This worked for me, but I had to put with \\ instead of \ and without the \bin (until the previous directory). Apr 21, 2022 at 11:14
  • if you want see video for solution see hare youtu.be/9mmY8rLvoRU
    – Codeplayon
    May 26, 2022 at 2:32
  • 3
    @Codeplayon please don't self-promote your videos in the comments section of others' answers
    – JustinW
    May 26, 2022 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.