Ronak Joshi Ronak Joshi - 3 years ago 226
Android Question

Android Google Place Picker working in Signed APK but not working in Live app

I have an application in which i have used Google Place Picker. There is very strange issue i am facing. When i am creating signed APK with my app's keystore, Place Picker is working very well. That same APK I have uploaded over Google PlayStore. When I come to open that Place Picker it automatically closed down. I already read a lots of comments online and also here in SO. But I can not determine why its working well in signed APK and the same APK which is over Google PlayStore is not working.

When i checked logs of LIVE application of Google PlayStore it giving error like this :

Volley : [198] BasicNetwork.performRequest: Unexpected response code 403
for https: // ? V / ConnectivityManager : isActiveNetworkMetered() returns: true
/ ? E / AsyncOperation : serviceID = 65, operation = SearchPlaces
OperationException[Status {
statusCode = PLACES_API_INVALID_APP, resolution = null

I already have checked into my Google Developer Console that my key is same or not. I also check my SHA which I have created from my KeyStore file. And all are good (Otherwise it will also not works in Signed APK if anything wrongs there).

Here is how I calling Place Picker from my Activity

PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
startActivityForResult(, PLACE_PICKER_REQUEST);

Here is my AndroidManifest.xml file where i have give my API key in meta data which is into application tag.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
package="com.example" >
android:theme="@style/AppTheme" >
android:label="@string/app_name" >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
android:value="@string/MY_KEY" />

There is file which i deleted "release/values/google_maps_api.xml" which is automatic generated. As i already mentioned my API key into string.xml, So I deleted this whole values package from release package.

Can anyone tell me what is wrong with this?

Answer Source

After several days of investing time for finding solution of this problem. Finally I got the solution. It is because of Google Play App Signing .

With Google Play App Signing: You sign your app with your upload key. Then, Google verifies and removes the upload key signature. Finally, Google re-signs the app with the original app signing key you provided and delivers your app to the user.

So, when I Created API key for "Google Places API for Android" I have restricted that key using my package name and my SHA-1 of Signed APK's KeyStore.

Now that is under "Upload Certificate" and it is not used, as I have to pass my App Singing Certificate's SHA-1 to Google Developer Console. And after doing that my Google PlayStore's live app's Google PlacePicker working well. enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download