该错误出现在包含React Native和Firebase的TypeScript项目上:
"@react-native-community/google-signin": "^4.0.3",
"@react-native-firebase/app": "^8.2.0",
"@react-native-firebase/auth": "^8.0.8",
"@react-native-firebase/firestore": "^7.2.2",
"@react-native-firebase/storage": "^7.1.6",
"@react-navigation/native": "^5.6.0",
"prop-types": "react-native-community/google-signin",
"react": "16.11.0",
"react-native": "0.62.2",
...在添加@react-native-community/google-signin之前,在Android上构建项目。然后我添加了它,并按照下面的步骤操作:https://github.com/react-native-community/google-signin/blob/master/docs/android-guide.md
我用./gradlew清理了构建
现在,当我运行yarn android时,我有:
D8: Program type already present: co.apptailor.googlesignin.PendingAuthRecovery
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:multiDexListDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: co.apptailor.googlesignin.PendingAuthRecovery我检查了build.gradle文件,但没有找到我可以添加的其他与身份验证相关的依赖项。该项目相对较新。
在android/app/build.gradle中,我有:
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:23.0.1"
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
implementation 'com.android.support:multidex:1.0.3'
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
}
}我在这里进行了所需的检查,但没有成功:https://github.com/react-native-community/google-signin/issues/763
发布于 2020-07-13 11:35:51
这是由于package.json中的这一行:
"prop-types": "react-native-community/google-signin",我删除了prop-type:
yarn remove prop-types现在,事情就像一个护身符一样工作。
这可能不是添加类型的好方法。
https://stackoverflow.com/questions/62868646
复制相似问题