Whenever I try to build or clean the project or try again. I am getting the following error
Unsupported class file major version 64
I am stuck to this problem and unable to find the solution
gradle-wrapper.properties
#Wed Oct 21 11:43:07 PKT 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
google()
}
}
tasks.register('clean', Delete) {
delete rootProject.buildDir
}
build.gradle(:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 33
buildToolsVersion '28.0.2'
defaultConfig {
applicationId "com.thumbsol.accuratemobileassetsmanagament"
minSdkVersion 19
targetSdkVersion 33
versionCode 1
versionName "1.0"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('androidx.test.espresso:espresso-core:3.5.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.10.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.jakewharton:butterknife:10.2.3'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
testImplementation 'junit:junit:4.13.2'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
implementation 'com.github.luongvo:GmailBackground:2.0.2'
}
Project Structure
I have also tried this solution but unable to resolve the problem
Any help would be highly appreciated.
It's likely that your build process is using different JDKs to build libraries and your app. This discrepancy can cause the issue you're encountering.
To solve the problem in the simplest way, I suggest using only one JDK version - specifically, the one defined in your JAVA_HOME environment variable. Delete the others to avoid any conflicts.
Open your terminal and type:
java --version
You might see an output like this:
openjdk 17.0.9 2023-10-17 OpenJDK Runtime Environment Temurin-17.0.9+9 (build 17.0.9+9) OpenJDK 64-Bit Server VM Temurin-17.0.9+9 (build 17.0.9+9, mixed mode)
Now, check the path to your JDK files:
echo $JAVA_HOME
An example output on macOS could be:
/Users/lucasmiranda/Library/Java/JavaVirtualMachines/jdk-17.0.9+9/Contents/Home
Navigate to the JavaVirtualMachines folder.
Delete the other JDK versions and keep only the one used by your JAVA_HOME.
If you encounter an issue with Android Studio trying to use a different JDK, configure it to point to your default JDK version.