Reputation:
When I am creating a new project in Android Studio, and load old projects I got this
java.lang.NoClassDefFoundError: org/gradle/internal/impldep/com/google/common/collect/Lists**
**java.lang.ClassNotFoundException: org.gradle.internal.impldep.com.google.common.collect.Lists
ERROR: Unable to load class 'org.gradle.internal.impldep.com.google.common.collect.Lists'
this is my gradle
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 29
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "com.ncf.fitness"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Upvotes: 4
Views: 9688
Reputation: 1
Repeat steps 2 to 5 on the project with the error
Edit: Make sure you're connected to the internet when creating the new project.
Upvotes: 0
Reputation: 656
Go to the Graddle directory located at C:/Users/Your Username/.
Rename the .gradle folder to .gradle2. If you encounter difficulties renaming it due to it being in use by another program, restart your PC and then proceed with renaming the folder before opening Android Studio.
After renaming the folder, reopen Android Studio.
Invalidate Cache and Restart:
If necessary, invalidate the cache and restart Android Studio by following these steps:
Go to File > Invalidate Caches.
Upvotes: 0
Reputation: 171
This helped me when I downgraded the gradle plugin. Before the version as on the screen
Upvotes: 1
Reputation: 1
I had the same problem, I solved it like this.
First go to the Module build.gradle file, in dependencies change gradle version to 3.2.1
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
Then go to the gradle-wrapper.properties file, change gradle version back to gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
Sync and you're done, problem solved.
I also had to change the versions of the dependencies in the build.gradle of the Project to
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
The end...
Upvotes: 0
Reputation:
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
You didn't add kotlin version. Try adding kotlin version instead of $kotlin_version
.
testImplementation 'junit:junit:4.+'
It also looks like it hasn't complete version name
.
Then sync
Upvotes: 1