Android 未找到与包名称';匹配的客户端;demo.abc.com.deals.debug';
我正在努力使用android应用程序登录谷歌。 我按照我创建的Android 未找到与包名称';匹配的客户端;demo.abc.com.deals.debug';,android,build.gradle,google-signin,google-play-services,Android,Build.gradle,Google Signin,Google Play Services,我正在努力使用android应用程序登录谷歌。 我按照我创建的google services.json文件中给定链接的步骤操作,该文件具有与AndroidMenifest.xml文件中相同的应用程序ID/包名。请快速查看下面的AndroidMenifest.xmlcode以及googleservices.json文件 AndroidMenifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmln
google services.json
文件中给定链接的步骤操作,该文件具有与AndroidMenifest.xml
文件中相同的应用程序ID/包名。请快速查看下面的AndroidMenifest.xml
code以及googleservices.json
文件
AndroidMenifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="demo.abc.com.deals">
<uses-sdk tools:overrideLibrary="com.facebook" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:name=".ParityApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
/>
<activity
android:name=".views.splash.SplashActivity"
android:configChanges="keyboard|orientation|screenSize"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:configChanges="keyboard|orientation|screenSize"
android:exported="false"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustPan" />
</application>
</manifest>
build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "demo.abc.com.deals"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dataBinding {
enabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
repositories {
mavenCentral()
}
buildTypes {
debug {
debuggable true
applicationIdSuffix '.debug'
buildConfigField("String", "SCHEME", "\"http:\"")
buildConfigField("String", "AUTHORITY", "\"//139.162.46.29\"")
buildConfigField("String", "SERVER_URL", "\"http://139.162.46.29/v3\"")
resValue 'string', 'app_name', 'Parity-SIT'
}
uat.initWith(buildTypes.debug)
uat {
applicationIdSuffix '.uat'
buildConfigField("String", "SCHEME", "\"http:\"")
buildConfigField("String", "AUTHORITY", "\"//139.162.46.29\"")
buildConfigField("String", "SERVER_URL", "\"http://139.162.46.29/v3\"")
resValue 'string', 'app_name', 'Parity-UAT'
}
release {
minifyEnabled false
resValue 'string', 'app_name', 'Parity'
buildConfigField("String", "SCHEME", "\"http:\"")
buildConfigField("String", "AUTHORITY", "\"//139.162.46.29\"")
buildConfigField("String", "SERVER_URL", "\"http://139.162.46.29/v3\"")
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:design:25.3.0'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-annotations:25.3.0'
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:support-v4:25.3.0'
compile 'com.facebook.android:facebook-android-sdk:4.18.0'
compile 'com.google.android.gms:play-services:9.0.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'me.tatarka.retrolambda'
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'me.tatarka:gradle-retrolambda:3.6.0'
classpath 'com.google.gms:google-services:3.0.0'
}
项目级构建。渐变
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "demo.abc.com.deals"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dataBinding {
enabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
repositories {
mavenCentral()
}
buildTypes {
debug {
debuggable true
applicationIdSuffix '.debug'
buildConfigField("String", "SCHEME", "\"http:\"")
buildConfigField("String", "AUTHORITY", "\"//139.162.46.29\"")
buildConfigField("String", "SERVER_URL", "\"http://139.162.46.29/v3\"")
resValue 'string', 'app_name', 'Parity-SIT'
}
uat.initWith(buildTypes.debug)
uat {
applicationIdSuffix '.uat'
buildConfigField("String", "SCHEME", "\"http:\"")
buildConfigField("String", "AUTHORITY", "\"//139.162.46.29\"")
buildConfigField("String", "SERVER_URL", "\"http://139.162.46.29/v3\"")
resValue 'string', 'app_name', 'Parity-UAT'
}
release {
minifyEnabled false
resValue 'string', 'app_name', 'Parity'
buildConfigField("String", "SCHEME", "\"http:\"")
buildConfigField("String", "AUTHORITY", "\"//139.162.46.29\"")
buildConfigField("String", "SERVER_URL", "\"http://139.162.46.29/v3\"")
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:design:25.3.0'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-annotations:25.3.0'
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:support-v4:25.3.0'
compile 'com.facebook.android:facebook-android-sdk:4.18.0'
compile 'com.google.android.gms:play-services:9.0.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'me.tatarka.retrolambda'
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'me.tatarka:gradle-retrolambda:3.6.0'
classpath 'com.google.gms:google-services:3.0.0'
}
在所有三个文件中,包名都是demo.abc.com.deals
,但我还是得到了这个错误
错误:任务“:app:processDebugGoogleServices”的执行失败。
找不到与包名称“demo.abc.com.deals.debug”匹配的客户端
我尝试了这里提出的同一个问题的每一个建议,但没有一个解决方案对我有效。
我真的可以利用所有用户的建议和经验来处理这个问题
google-services.json文件添加目录结构
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "demo.abc.com.deals"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dataBinding {
enabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
repositories {
mavenCentral()
}
buildTypes {
debug {
debuggable true
applicationIdSuffix '.debug'
buildConfigField("String", "SCHEME", "\"http:\"")
buildConfigField("String", "AUTHORITY", "\"//139.162.46.29\"")
buildConfigField("String", "SERVER_URL", "\"http://139.162.46.29/v3\"")
resValue 'string', 'app_name', 'Parity-SIT'
}
uat.initWith(buildTypes.debug)
uat {
applicationIdSuffix '.uat'
buildConfigField("String", "SCHEME", "\"http:\"")
buildConfigField("String", "AUTHORITY", "\"//139.162.46.29\"")
buildConfigField("String", "SERVER_URL", "\"http://139.162.46.29/v3\"")
resValue 'string', 'app_name', 'Parity-UAT'
}
release {
minifyEnabled false
resValue 'string', 'app_name', 'Parity'
buildConfigField("String", "SCHEME", "\"http:\"")
buildConfigField("String", "AUTHORITY", "\"//139.162.46.29\"")
buildConfigField("String", "SERVER_URL", "\"http://139.162.46.29/v3\"")
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:design:25.3.0'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-annotations:25.3.0'
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:support-v4:25.3.0'
compile 'com.facebook.android:facebook-android-sdk:4.18.0'
compile 'com.google.android.gms:play-services:9.0.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'me.tatarka.retrolambda'
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'me.tatarka:gradle-retrolambda:3.6.0'
classpath 'com.google.gms:google-services:3.0.0'
}
在渐变底部添加以下代码
apply plugin: 'com.google.gms.google-services'
像这样
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:11.0.1'
compile 'com.google.android.gms:play-services-auth:11.0.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
最后,我在将google登录集成到我的应用程序时解决了这个问题, 当我试图为我的应用程序设置google登录时,我在app level
build.gradle
文件中添加了3个构建变体
当我添加了googleservices.json
时,它工作得很好。对于每种构建类型,在app/src
文件夹中应该有相应的director。在相应的build variants文件夹中添加google services.json
文件后,请查看下面的dir结构屏幕截图
补救性变化
在所有googleservices.json
文件中,您应该根据构建类型指定正确的包名称
例如,在debug dir中,它应该类似于
“package\u name”:“demo.abc.com.deals.debug”
您可以发布您的gradle文件吗可以发布项目级gradlefile@Anil,请检查编辑的问题中的项目级build.gradle
文件。我可以看到您粘贴json文件的地方的屏幕截图吗?使用这个编译'com.google.android.gms:play services auth:11.0.1'而不是编译'com.google.android.gms:play services:9.0.0'我试过了,但没有用,不过我还是遇到了同样的错误。你能不能发布项目级GRDLECOMILE已经过时了你需要使用实现代替谢谢!在找到这个有效的答案之前,我也搜索了很多地方@雷利,如果这个答案对你有帮助,请接受它作为答案。谢谢什么意思?你问了又回答了这个问题,所以只有你才能接受这个答案;)@雷利,我的意思是投票赞成这个答案,别无其他选择。谢谢