java - 无法加载类“org.gradle.internal.impldep.com.google.common.collect.Lists”
问题描述
我在我的 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
}
}
我已经看到了这个问题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)。那解决了它。不知道起始事件。提交了一个错误。
推荐阅读
- batch-file - 批处理文件。迭代目录搜索排除一个
- javascript - 如何在javascript中执行查询
- python - 图像处理练习和 np.array 索引
- javascript - 反应中功能组件的早期回报
- javascript - 有条件地设置和清除间隔
- next.js - 如何在部署到 Vercel 的 Next js 中禁用目录列表
- spring-boot - 为什么 mvn spring-boot:run 找不到一些 ojdbc8 相关的 jar?
- javascript - 无法在 forEach 方法中返回 thisArg
- scala - sbt 返回依赖问题
- javascript - 考虑随时间的加速度和减速度的对象插值