Target option 1.5 is no longer supported. Use 1.6 or later

497 Views Asked by At

I keep getting this error message when compiling my app to an apk: error message I've found a lot of posts about pom.xml I tried multiple times to find the pom.xml file. So does anyone know where it is or how to fix this error?

This is my android studio version btw: version

2

There are 2 best solutions below

0
On BEST ANSWER

Newest Android Studio does not support java 1.5 as a compilation target. Switch to 1.6 or later (newest recommendation is java 11). Here is how:

android {
    compileSdkVersion 30

    compileOptions {
      sourceCompatibility JavaVersion.VERSION_11
      targetCompatibility JavaVersion.VERSION_11
    }

    // For Kotlin projects
    kotlinOptions {
      jvmTarget = "11"
    }
}

source

1
On

Similar to Jakos, I found the following in my app\build.gradle :

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_5
    targetCompatibility JavaVersion.VERSION_1_5
}

This was probably left over from upgrading an eclipse project, once removed the project compiled.