當我嘗試在運行時爲特定的android風格獲取gcm_defaultSenderId時,它不提供正確的值。來自google-services.json的值返回錯誤
例如:我得到的味道TST和谷歌,services.json看起來像這樣
{
"project_info": {
"project_number": "12345678910", 12345678910
"project_id": "api-project-12345678910"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:12345678910:android:xxxxxxxxxxxxx",
"android_client_info": {
"package_name": "do.something.app"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "XXXxxxx-XXXXxxxXXXXXxxxxXXXx"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 1
}
}
}
],
"configuration_version": "1"
}
的JSON文件被放置在尖沙咀/谷歌services.json。當我嘗試在運行時使用R.string.gcm_defaultSenderId訪問gcm_defaultSenderId時,返回值爲:9876543。我期望返回值是構建到gcm_defaultSenderId時所設置的project_number,如其寫入:https://developers.google.com/android/guides/google-services-plugin。有沒有人知道爲什麼這個值與google-service.json中的值不一樣?
您的構建變體的名稱和目錄名稱應完全匹配 –
它們完全相同 – elpatricko
http://imgur.com/AsjllwM它們看起來像這樣嗎? –