android - 错误:任务“:app:processDebugGoogleServices”执行失败。> 找不到与包名称 'com.xx.xxx.xxxx' 匹配的客户端
问题描述
当我尝试将我的项目与 Gradle 文件同步时出现错误
这是错误
错误:任务“:app:processDebugGoogleServices”执行失败。找不到与包名称“com.xx.xxx.xxxx”匹配的客户端
这是我的 Gradle 文件内容:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.xx.xxx.xxxx"
minSdkVersion 19
targetSdkVersion 22
versionCode 1
versionName "1.0.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
useLibrary 'org.apache.http.legacy'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:support-v4:26.1.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.firebase:firebase-messaging:11.0.4'
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.jakewharton:butterknife:7.0.1'
provided 'org.projectlombok:lombok:1.12.6'
compile 'org.parceler:parceler-api:1.0.4'
apt 'org.parceler:parceler:1.0.4'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'io.reactivex:rxandroid:1.1.0'
compile 'io.reactivex:rxjava:1.1.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'com.google.maps:google-maps-services:0.2.5'
compile 'org.slf4j:slf4j-nop:1.7.25'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.cocosw:bottomsheet:1.+@aar'
}
apply plugin: 'com.google.gms.google-services'
我检查了我的 google-service 文件包名称和应用程序 ID,两者都相同,但是当我尝试构建应用程序时,发生了上述错误。我的 google-services 文件包含多个项目,包括这个。
请帮我修复它。
解决方案
首先,去android/app/build.gradle
搜索applicationId
(within android
, defaultConfig
)
并确保该值与此相同
client[0]client_info.android_client_info.package_name
作为 内的值google-services.json
。
然后,尝试更新 Project grandle(到最新版本),如下所示:
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:4.0.1'
还要更新 firebase 依赖项,例如(选择您需要的),这是基于此链接的最新版本:
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-ads:15.0.1'
implementation 'com.google.firebase:firebase-analytics:16.0.0'
implementation 'com.google.firebase:firebase-appindexing:15.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-firestore:17.0.1'
implementation 'com.google.firebase:firebase-functions:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-crash:16.0.0'
implementation 'com.google.firebase:firebase-invites:16.0.0'
implementation 'com.google.firebase:firebase-perf:16.0.0'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-config:16.0.0'
这是基于此链接的大应用程序文件(选择您需要的) :
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-places:15.0.1'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.maps.android:android-maps-utils:0.5'
推荐阅读
- java - 如何强制 java OutputStreamWriter 实际写入单个字节?
- javascript - 遍历两个数组时选择输出
- azure - 使用 ARM 模板启用自动配置的 Azure 安全中心不起作用
- html - 将 CSS 规则应用于匹配多个可能属性值之一的元素
- javascript - 访问和更改类 javascript 中的数组值
- vue.js - 如何在 quasar vue 组件环境中使用 require('electron')?
- python - tkinter 在 Canvas 中使用 Timer 连续移动对象
- excel - 每次我运行宏来绘制图表时,如何在 excel 中的预定义位置绘制图表?
- javascript - 临时禁用 fontawesome JS
- php - WordPress 功能“register_post_type”未显示在管理员左侧边栏中