在我将compileSdkVersion从29更改为31之后,因为我不得不,它不会构建我的应用程序,现在我得到了这个错误。
‘`FAILURE:生成失败,异常。
问题所在:任务':app:checkDebugDuplicateClasses'.的执行失败
在执行com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable重复类com.facebook.jni.CppException时发生了故障,这些重复类出现在以下模块中:fbjni 0.3.0-运行时(com.facebook.fbjni:fbjni:0.3.0)和java java-仅-0.2(com.facebook.fjni:fbjni-java-仅:0.2.2)模块中发现的重复类com.facebook.jni.CppSystemErrorException( fbjni:0.3.0)和java fbjni-java-仅0.2(com.facebook.fbjni:fbjni-java-只:0.2.2)模块中发现的重复类com.facebook.jni.DestructorThread -fbjni-0.3.0-运行时(com.facebook.fbjni:fbjni:0.3.0)和fbjni and纯java-0.2(com.facebook.fjni:fbjni-java-只有:0.2.2)模块中发现的重复类com.facebook.jni.DestructorThread$1jetified 0.3.0-运行时(com.facebook.fbjni:fbjni:0.3.0)和jetified java-仅0.2(com.facebook.fbjni:fbjni-java-只:0.2.2)模块中的重复类com.facebook.jni.DestructorThread$Destructor -fbjni-0.3.0运行时(com.facebook.fbjni:fbjni:0.3.0)和fbjni java-只读-0.2(com.facebook.fbjni:fbjni-java-仅:( 0.2.2)模块中发现的重复类com.facebook.jni.DestructorThread$DestructorList - and 0.3.0-运行时(com.facebook.fbjni:fbjni:0.3.0)和java java-仅0.2(com.facebook.fbjni:fbjni-java-仅:0.2.2)模块中的重复类com.facebook.jni.DestructorThread$DestructorStack -运行时(com.facebook.fbjni:fbjni:0.3.0)和java java-只-0.2(com.facebook.fbjni:fbjni-java-只:0.2.2)模块中发现的重复类com.facebook.jni.DestructorThread$Terminus -fbjni-0.3.0-运行时(com.facebook.fbjni:fbjni:0.3.0)和java java-仅-0.2(com.facebook.fbjni:fbjni-java-仅:0.2.2)模块中发现的重复类com.facebook.jni.HybridClassBase -fbjni-0.3.0-运行时(com.facebook )( .fbjni:fbjni:0.3.0)和java java仅限-0.2(com.facebook.fbjni:fbjni-java-仅:0.2.2)模块中发现的重复类com.facebook.jni.HybridData - and 0.3.0-运行时(com.facebook.fbjni:fbjni:0.3.0)和java java-仅-0.2(com.facebook.fbjni:fbjni-java-仅:0.2.2)重复类com.facebook.jni.HybridData$Destructor在模块jetified 0.3.0-运行时(com.facebook.fbjni:0.3.0)和java java-仅0.2 (com.facebook.fbjni:fbjni-java -只:0.2.2)模块中找到的重复类com.facebook.jni.IteratorHelper -运行时(com.facebook.fbjni:fbjni:0.3.0)和jetified java-只-0.2(com.facebook.fbjni:fbjni-java)-only:0.2.2)模块中发现的重复类com.facebook.jni.MapIteratorHelper -- and 0.3.0-运行时(com.facebook.fbjni:fbjni:0.3.0)和java java-仅0.2(com.facebook.fbjni:fbjni-java-仅:0.2.2)模块中发现的重复类com.facebook.jni.NativeRunnable -fbjni-0.3.0-运行时(com.facebook.fbjni:fbjni:0.3.0)-纯java-0.2(com.facebook.fbjni:fbjni-java-仅:0.2.2)模块中发现的重复类com.facebook.jni.ThreadScopeSupport -fbjni-0.3.0-运行时(com.facebook.fbjni:0.3.0)和java java只-0.2(com.facebook.fbjni:fbjni-java-仅:0.2.2)模块中发现的重复类com.facebook.jni.UnknownCppException - and 0.3.0-运行时((com.facebook.fbjni:fbjni:0.3.0)和jetified java-仅0.2(com.facebook.fbjni:fbjni-java-只:0.2.2)模块中发现的重复类com.facebook.jni.annotations.DoNotStrip -fbjni-0.3.0-运行时( com.facebook.fbjni:fbjni:0.3.0)和fbjni and java只-0.2 com.facebook.jni.annotations.DoNotStrip
我发现这个错误-> https://github.com/facebook/react-native/issues/34328类似于我的错误,但我不知道如何修复它。
这是我的反应-本地信息
System:
OS: macOS 12.3.1
CPU: (8) arm64 Apple M1
Memory: 173.81 MB / 8.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 18.0.0 - /opt/homebrew/bin/node
Yarn: Not Found
npm: 8.6.0 - /opt/homebrew/bin/npm
Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8309675
Xcode: 13.3.1/13E500a - /usr/bin/xcodebuild
Languages:
Java: 11.0.15 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: 0.64.2 => 0.64.2
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found我已经尝试了我发布的链接的结果,但我无法让它开始工作。
这是我的android/build.gradle文件:
buildscript {
ext {
buildToolsVersion = "29.0.3"
minSdkVersion = 24
compileSdkVersion = 31
targetSdkVersion = 31
kotlin_version = '1.5.0'
}
repositories {
google()
jcenter()
}
dependencies {
classpath('com.android.tools.build:gradle:4.2.1')
classpath 'com.google.gms:google-services:4.3.8'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
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/app/build.gradle的依赖项
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
implementation 'com.google.android.gms:play-services-analytics:17.0.0'
implementation platform('com.google.firebase:firebase-bom:28.2.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.8.5'
implementation 'com.fasterxml.jackson.core:jackson-core:2.8.5'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.8.5'
api 'com.facebook.fbjni:fbjni-java-only:0.2.2'
implementation 'org.pytorch:pytorch_android:1.9.0'
implementation 'com.facebook.react:react-native:+'
// For displaying GIFs
implementation 'com.facebook.fresco:fresco:2.0.0'
implementation 'com.facebook.fresco:animated-gif:2.0.0'
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'
exclude group:'com.squareup.okhttp3', module:'okhttp'
}
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
}}
发布于 2022-11-07 13:53:57
这是11月4日起与RN有关的问题。随着新的更新,他们打破了旧的RN版本的android版本。更多信息和修复-> https://github.com/facebook/react-native/issues/35210
https://stackoverflow.com/questions/74344054
复制相似问题