java - 无法加载类 'org.gradle.internal.impldep.com.google.common.collect.Lists'

标签 java android gradle

我在我的 Android Studio 中导入了项目,但遇到了这个错误,

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

这是我的依赖项

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

我已经看到这个问题了No Class Found: com.google.common.collect.Lists但是当我尝试添加 https://github.com/google/guava错误仍然存​​在

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' }
    }
}

最佳答案

我也是这个问题。 Android Studio 完全搞砸了。使/重新安装/新项目无效。还是被坑了。删除了 .gradle 目录 (Linux)。那修好了。不知道始发事件。提交错误。

关于java - 无法加载类 'org.gradle.internal.impldep.com.google.common.collect.Lists',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65821231/

相关文章:

java - RecyclerView.setLayoutManager 上的 NPE

java - 魔数(Magic Number) : Checks for magic numbers

java - 谷歌机器学习套件,在 Android 上使用 ML 套件识别图像中的文本错误

android - Intent PACKAGE_ADDED 未注册

android - 使用旧版本Gradle库的Android Studio

java - ScheduledThreadPoolExecutor 停止执行并捕获异常

android - 查看页面 : lose the state of toggle button when swiping

java - Android Studio 3.1.3 错误。 java.lang.IllegalStateException : Could not execute method for android:onClick 错误

android - 什么是委托(delegate)对象?

gradle - 如何覆盖构建目录中的 Spring 属性文件?