Unable to load class 'org.gradle.internal.impldep.com.google.common.collect.Lists'

Viewed 2915

I have imported project in my Android Studio and I encounter this error,

  • Caused by: java.lang.NoClassDefFoundError: org/gradle/internal/impldep/com/google/common/collect/Lists
  • Caused by: java.lang.ClassNotFoundException: org.gradle.internal.impldep.com.google.common.collect.Lists

this is my dependencies

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    //noinspection GradleDynamicVersion
    implementation 'com.facebook.react:react-native:0.20.1'  // From node_modules

implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'

implementation("com.google.guava:guava:30.1-jre")

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
  exclude group:'com.facebook.fbjni'
}

debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
    exclude group:'com.facebook.flipper'
}

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
    exclude group:'com.facebook.flipper'
}

if (enableHermes) {
    def hermesPath = "../../node_modules/hermes-engine/android/";
    debugImplementation files(hermesPath + "hermes-debug.aar")
    releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
    implementation jscFlavor
}

}

enter image description here

I already saw this question No Class Found: com.google.common.collect.Lists but when i tried to add the https://github.com/google/guava the error still exist

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.5.2")
        compile "com.google.guava:guava:16+"
        compile  "junit:junit:4.10"
    }
}

allprojects {
    repositories {

        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        jcenter()
        maven { url 'https://www.jitpack.io' }
    }
}
1 Answers

Same issue for me. Android Studio completely buggered. Invalidate/reinstall/new project. Still buggered. Deleted .gradle directory (Linux). That fixed it. No idea of the initiating event. Filed a bug.

Related