首页 > 解决方案 > Android Studio - 找不到与包名称“''匹配的客户端

问题描述

我已经导入了模块(多个项目)。导入它们后同步很完美,但是当尝试运行应用程序时,它显示了这个错误 错误

这是我的 build.gradle 文件:

应用插件:'com.android.application' 应用插件:'com.google.gms.google-services'

android { compileSdkVersion 29 buildToolsVersion "29.0.3"

defaultConfig {
    applicationId "com.example.secondyr"
    minSdkVersion 16
    targetSdkVersion 29
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}

}

依赖项 { implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-database:19.3.1'
implementation 'com.google.firebase:firebase-storage:19.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation project(path: ':SecondYearCivil')
implementation project(path: ':SecondYearCs')
implementation project(path: ':SecondYearElectronics')
implementation project(path: ':SecondYearElectronicsandTelecom')
implementation project(path: ':SecondYearProd')
implementation project(path: ':SecondYearMech')
implementation project(path: ':SecondYearTextile')
implementation project(path: ':SecondYearIT')
implementation project(path: ':SecondYearETC')

}

我在 stackoverflow 上看到过类似的问题,但我理解。我读到了这个解决方案,将 .json 文件中的包名更改为 manisfest 中的包名,我不明白要更改哪一个,因为有很多包名

标签: javaandroid

解决方案


Check your package name on your google-services.json it should be same with your local package name of your app

Something like this

"client_info": {
    "mobilesdk_app_id": "1:6596814400689:android:65d6f25f5006145",
    "android_client_info": {
      "package_name": "com.my.app.package.name"
    }

推荐阅读