【问题标题】:google-services.json No matching client found for package name with any modulegoogle-services.json 找不到与任何模块的包名称匹配的客户端
【发布时间】:2018-06-14 18:36:12
【问题描述】:

我将应用程序中的 app 模块重命名为 presentation 模块。

  • 我将 google-services.json 放在我的演示文稿中/
  • 已添加classpath "com.google.gms:google-services:3.1.0"
  • 添加插件:apply plugin: 'com.google.gms.google-services'

当我尝试同步 gradle 时,我得到了错误:

Error:Execution failed for task ':presentation:processDebugGoogleServices'.
No matching client found for package name 'ru.company.acitive.activelife'

我的 build.gradle sn-p:

dependencies {
    classpath "com.android.tools.build:gradle:$android_plugin_version"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath "com.google.gms:google-services:3.1.0"
}

我的演示文稿/build.gradle sn-p:

dependencies {

...

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'

【问题讨论】:

    标签: android firebase


    【解决方案1】:

    这意味着您的应用的应用 ID 是“ru.company.acitive.activelife”,但在您的 google-services.json 文件中找不到相同的字符串。

    看起来“主动”的部分有错字。应该改为“活跃”吗?

    【讨论】:

    • 我遇到了同样的问题。看到您的答案后,我再次检查并在我的 gradle 文件中发现了一个错字。我在 gradle 中写了com.example.developmnet,但 Firebase 包含:com.example.development
    【解决方案2】:

    除了确保您的 gradle androidApplicationID 与您的 google-services.json 匹配(如 here 所讨论的那样)之外,此消息还可能是由于 gradle 未找到您的密钥库文件而导致的。

    确保在您的项目级 build.gradle 文件中有这些条目:

    keystoreStoreFile = _________
    keystoreStorePassword = ____________
    keystoreKeyAlias = _______________
    keystoreKeyPassword = ____________
    

    当 Android Studio 在“生成签名的 APK”操作期间提示您输入它们时,请务必使用相同的四个值。

    在我的例子中,我试图构建 Google 提供的示例应用程序 ClassyTaxi 用于说明订阅服务。它有一个引用 keystorePropertiesFile=keystore.properties 的项目级 build.gradle 文件。该属性文件不存在,但有一个 example-keystore.properties 文件,我将其重命名为 keystore.properties 并用我选择的四个值填充它。然后,我在使用 Android Studio 生成签名的 APK 时使用了完全相同的四个值。

    【讨论】:

      【解决方案3】:

      在我自己的情况下,我的应用级 build.gradle 文件中的以下行是罪魁祸首:

      applicationIdSuffix ".debug"
      

      我从另一个开发人员那里继承了代码库,所以我最初并不知道这条线的存在。

      【讨论】:

        猜你喜欢
        • 2019-06-19
        • 1970-01-01
        • 2020-10-19
        • 2021-10-08
        • 1970-01-01
        • 2016-06-22
        • 2019-01-13
        相关资源
        最近更新 更多