我正在开发一个移动应用程序,一切都很好,构建,甚至制作。/gradlew bundleRelease
,一切都正常,然后突然我的第一个错误:
(这是我的问题)
React-Native Android构建错误Task": app:checkDebugDuplicateClass"
但是我修复了它,现在我有这个错误:: app:compileDebugJavaWellJavac
buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
这就是错误:
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
> Could not find io.jsonwebtoken:jjwt-api:0.10.7.
Required by:
project :app > project :@notifee_react-native
project :app > project :notifee_react-native
> Could not find com.google.guava:listenablefuture:1.0.
Required by:
project :app > androidx.browser:browser:1.5.0-rc01
> Could not find com.facebook.infer.annotation:infer-annotation:0.11.2.
Required by:
project :app > com.facebook.react:react-native:0.61.5
> Could not find javax.inject:javax.inject:1.
Required by:
project :app > com.facebook.react:react-native:0.61.5
> Could not find com.facebook.fresco:fresco:2.0.0.
Required by:
project :app > com.facebook.react:react-native:0.61.5
> Could not find com.facebook.fresco:imagepipeline-okhttp3:2.0.0.
Required by:
project :app > com.facebook.react:react-native:0.61.5
> Could not find com.facebook.soloader:soloader:0.6.0.
Required by:
project :app > com.facebook.react:react-native:0.61.5
> Could not find com.google.code.findbugs:jsr305:3.0.2.
Required by:
project :app > com.facebook.react:react-native:0.61.5
> Could not find com.squareup.okhttp3:okhttp:3.12.1.
Required by:
project :app > com.facebook.react:react-native:0.61.5
> Could not find com.squareup.okhttp3:okhttp-urlconnection:3.12.1.
Required by:
project :app > com.facebook.react:react-native:0.61.5
> Could not find com.squareup.okio:okio:1.15.0.
Required by:
project :app > com.facebook.react:react-native:0.61.5
> Could not find org.jetbrains.kotlin:kotlin-stdlib:1.8.0.
Required by:
project :app > androidx.annotation:annotation-jvm:1.6.0-beta01
buildscript {
ext {
buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
kotlinVersion = "1.4.0"
RNNKotlinVersion = kotlinVersion
playServicesVersion = "16.0.0"
googlePlayServicesVersion = "17.0.0"
}
repositories {
google()
maven {
url 'https://maven.fabric.io/public'
}
mavenLocal()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.1" // after
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "com.google.gms:google-services:4.2.0"
classpath "io.fabric.tools:gradle:1.+"
classpath "io.jsonwebtoken:jjwt-api:0.10.7"
}
}
尝试了很多东西。都没用。
所以,这基本上是解决方案。
您需要将此代码添加到app/build. gradle
中的依赖项
:
constraints {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0") {
because("kotlin-stdlib-jdk7 is now a part of kotlin-stdlib")
}
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0") {
because("kotlin-stdlib-jdk8 is now a part of kotlin-stdlib")
}
}
和ndkVersion"25.1.8937393"
到android
在同一个文件中,如下所示:
android {
ndkVersion "25.1.8937393" // <- Add this line
}
在android/gradle/包装器/gradle-wrapper.properties
中也将版本更改为6.9
,如下所示:/gradle-6.9-all.zip
在android/build. gradle
中,我的kotlin是1.6.21
和com.android.tools.build:gradle:4.0.1
。
编码愉快