我在这里有点绝望。我的React-Native应用程序有两个应用程序文件夹,这两个文件夹都包含一个google-services.json文件,其中包含正确的结构和一个" package_name"肯定存在并具有正确的价值。该文件看起来像:
{
"project_info": {
"project_number": "123456789123",
"firebase_url": "https://myproject.firebaseio.com",
"project_id": "my-project",
"storage_bucket": "my-project.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:878210515221:android:64cb9c9ba170c841",
"android_client_info": {
"package_name": "com.mycompany.appstore.myproject"
}
},
"oauth_client": [
{
"client_id": "123456789123-ipr3gfqml3oaajpk1lsq6gvf81mebkcm.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "mykey-xxxx-xxxx-xxxx"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 2
}
}
}
],
"configuration_version": "1"
}
google-services.json文件都有相同的内容(在本例中我用虚拟文本替换了一些值),但react-native run-android
命令一直给我No matching client found for package name ''
警告,并且它甚至没有提到package_name,但是它说它是一个空字符串。
互联网上的所有解决方案都是"放一个google-services.json"文件在您的应用程序文件夹在这种情况下,这显然对我没有帮助。知道问题是什么吗?
答案 0 :(得分:1)
如果您有多个Flavor,则需要在firebase门户上为同一个应用程序创建多个客户端
例如(在android中)
productFlavors {
prod {
applicationId "com.xyz.abc"
dimension "tier"
}
apiary {
applicationId "com.xyz.abc.apiary"
dimension "tier"
}
local {
applicationId "com.xyz.abc.local"
dimension "tier"
}
}
否则请在app和google-services.json中检查您的包名称