React Native命令行'processDebugGoogleServices'错误

时间:2018-03-27 09:14:17

标签: react-native react-native-android

我正在尝试使用以下build.gradle文件构建一个应用程序,但始终有一个错误无法创建文件夹。我检查了很多答案,但没有人帮助我。

* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> Failed to create folder: D:\App\android\app\build\generated\res\google-services\debug

我的app/build.gradle文件

dependencies {
    compile project(':react-native-android-permissions')
    compile project(':react-native-push-notification')
    compile project(':react-native-fbsdk')
    compile project(':react-native-google-signin')
    compile project(':react-native-image-resizer')
    compile project(':react-native-image-picker')
    compile project(':react-native-fs')
    compile project(':react-native-vector-icons')
    compile project(':react-native-maps')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:25.0.0"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile project(':RNPermissionsModule')
    compile(project(":react-native-google-signin")) {
        exclude group: "com.google.android.gms"
    }
    compile(project(':react-native-fbsdk')){
        exclude(group: 'com.facebook.android', module: 'facebook-android-sdk')
    }
    compile "com.facebook.android:facebook-android-sdk:4.22.1"
    compile "com.google.android.gms:play-services-maps:11.8.0"
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile "com.android.support:appcompat-v7:25.0.1"
    compile project(':react-native-push-notification')
    compile ('com.google.android.gms:play-services-gcm:11.8.0') {
        force = true;
    }
}
apply plugin: 'com.google.gms.google-services'

2 个答案:

答案 0 :(得分:1)

我也遇到了同样的问题,我通过从您的设备(例如您的移动设备)上卸载应用[yourapp.apk]并再次运行react-native run-android来解决了这个问题,

>

但是为什么? 因为您已经在设备上安装了具有相同名称的应用程序(主要是因为您已从某处下载了该应用程序的原因-现在您要运行具有相同名称的test.app,因此为什么会遇到此错误

如果它不适合您,请随时问我任何问题!

答案 1 :(得分:0)

您是否也在classpath中使用过google服务插件? 如果没有,请写在app文件夹

之外的build.gradle中
classpath 'com.google.gms:google-services:3.0.0'

我认为这会对你有帮助.. !!