我有一个反应原生项目,我正试图在其上设置谷歌登录。为此,我需要设置react-native-google-signin插件,该插件要求我将以下内容添加到build.gradle文件中:
compile(project(":react-native-google-signin")){
exclude group: "com.google.android.gms" // very important
}
compile 'com.google.android.gms:play-services-auth:9.2.1'
当我这样做时,我得到如下构建错误:
Found com.google.android.gms:play-services-auth:9.2.1, but version 9.0.0 is needed for the google-services plugin.
:app:processDebugGoogleServices FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1.62 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment.
Go to https://facebook.github.io/react-native/docs/getting-started.html
and check the Android tab for setup instructions.
当我制作play-services-auth 9.0.0时,它给了我这个错误:
:app:transformClassesWithJarMergingForDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/common/api/zza.class
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 2.107 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment.
Go to https://facebook.github.io/react-native/docs/getting-started.html
and check the Android tab for setup instructions.
我的build.gradle依赖项如下所示:
dependencies {
compile project(':react-native-fbsdk')
compile(project(':react-native-firebase-analytics')){
exclude group: "com.google.android.gms" // very important
}
compile project(':react-native-share')
compile project(':react-native-video')
compile project(':react-native-uuid-generator')
compile project(':react-native-udp')
compile project(':react-native-tcp')
compile project(':react-native-code-push')
compile project(':react-native-camera')
compile project(':react-native-linear-gradient')
compile project(':react-native-vector-icons')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
compile project(':react-native-image-picker')
compile(project(":react-native-google-signin")){
exclude group: "com.google.android.gms" // very important
}
compile 'com.google.android.gms:play-services-auth:9.0.0'
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
知道发生了什么事吗?我在其他线程上尝试了许多修复但没有帮助。我会一直得到这两个错误。请帮忙!
完整错误日志位于:https://gist.github.com/THPubs/1ca6405f62671c698c4aee0c73c8324e