我試圖安裝推送通知,並按照firebase上的說明進行操作,但在我的gradle文件中添加行並嘗試同步後,出現以下錯誤。Firebase推送通知 - Google服務問題
Error:Execution failed for task ':app:processDebugGoogleServices'. No matching client found for package name 'com.project.myproject'
我下載了google-services.json文件,並將它放在項目下的我的apps文件夾中。
這裏是我的品位文件
應用
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
模塊
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.project.myproject"
minSdkVersion 15
targetSdkVersion 24
versionCode 39
versionName "1.0.0.39"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:design:24.2.0'
compile 'com.mcxiaoke.volley:library:1.0.18'
compile 'com.android.support:support-v4:24.2.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.firebase:firebase-messaging:9.8.0'
}
apply plugin: 'com.google.gms.google-services'
你可以發佈你的樹,文件層次結構?你有沒有檢查你的google-services.json package_name是否與applicationId相同? – GuilhE
[找不到與包名(Google Analytics)匹配的客戶端 - 多個productFlavors&buildTypes](http://stackoverflow.com/questions/34990479/no-matching-client-found-for-package-name-google -analytics-multiple-productf) – GuilhE
是包名是相同的。我花了一個小時尋找這個問題,發現了類似的問題,但沒有一個答案適合我。但問題。是否google-services.json只應該在APP文件夾中?或者在其他地方......用於調試等? –