2016-09-26 76 views
0

我添加火力,以我的應用程序,並在日誌中我看到這一點:GoogleService初始化失敗,但所有的設置是正確的

GoogleService failed to initialize, status: 10, Missing an expected resource: 
'R.string.google_app_id' for initializing Google services. Possible causes are missing google-services.json 
or com.google.gms.google-services gradle plugin. 

但我google-services.json文件在app /目錄,這是我的gradle產出:

buildscript { 
    repositories { 
     jcenter() 
     mavenLocal() 
    } 

    dependencies { 
     classpath 'com.google.gms:google-services:3.0.0' 
    } 
} 
apply plugin: 'com.android.application' 


repositories { 
    jcenter() 
    mavenLocal() 
} 


android { 
    .... 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile('com.crashlytics.sdk.android:crashlytics:[email protected]') { 
     transitive = true; 
    } 
    compile 'com.android.support:appcompat-v7:24.2.1' 
    compile 'com.android.support:design:24.2.1' 
    compile 'com.android.support:support-v4:24.2.1' 
    compile 'com.facebook.android:facebook-android-sdk:4.+' 
    compile 'com.google.android.gms:play-services-auth:9.6.0' 
    compile 'com.google.android.gms:play-services-appindexing:9.6.0' 
    compile 'com.google.firebase:firebase-core:9.6.0' 
    compile 'com.google.firebase:firebase-messaging:9.6.0' 
} 


apply plugin: 'com.google.gms.google-services' 

回答

0

更改順序

compile 'com.google.firebase:firebase-core:9.6.0' 
compile 'com.google.firebase:firebase-messaging:9.6.0' 
compile 'com.google.android.gms:play-services-auth:9.6.0' 
compile 'com.google.android.gms:play-services-appindexing:9.6.0'