Android Studio 3.0.1: This is a common problem but I cannot find a solution to my version of it anywhere.
I have successfully created a Debug.apk using Google Maps which runs perfectly on my attached Samsung device.
Next I put the Release Key in the manifest and create the Release.apk which is then uploaded to Google Play
Store. On downloading it then fails to show the map, just the Google Icon and other files.
On Android Studio there is no debug/res/values or release/res/values under app/src and no google_maps_api.xml file
anywhere.
How can I fix this please?
You need to register your API hash with the Google APi console: https://console.developers.google.com/apis
Google signed app
If you are using Google Play signing the instructions for getting all the information you need are here: https://support.google.com/googleplay/android-developer/answer/7384423?hl=en-GB in Step 4:
"If your app uses any API, you will usually need to register the certificate of the key Google signs your app with for authentication purposes. This is usually done through the fingerprint of the certificate.
To find the certificate of the key Google uses to re-sign your APK for delivery:
Sign in to your Play Console.
Select an app.
On the left menu, click Release management > App signing.
From this page, you can copy the most common fingerprints (MD5, SHA-1 and SHA-256) of your app signing certificate. If the API provider requires a different type of fingerprint, you can also download the original certificate in DER format and run it through the transformation tools that the API provider requires."
Self signed app
You will need to get the SHA1 from the signed key yourself. For a command line to do this see: https://developers.google.com/maps/documentation/android-api/signup
For instructions on adding this to the API console see here:
https://developers.google.com/maps/documentation/android-api/signup
If these instructions aren't clear, here's a more step by step version:
go to https://console.developers.google.com/apis/credentials
choose your project
You should be on a screen that has a list of API keys
Click on the API key your are using in your App
Make sure the "Key restriction" is "Android apps"
There is now a section saying "Restrict usage to your Android apps (Optional). Add your package name and SHA-1 signing-certificate fingerprint to restrict usage to your Android apps. Get the package name from your AndroidManifest.xml file. Then use the following command to get the fingerprint:"
Add the package name and SHA1 for your release app
If you are creating debug apk then you have to add your sha1 key to google api console and also you have to enable google map service in google api console
Related
I have google login in my app which was working completely fine before publishing my app.But after publishing i am unable to sign in due to change in SHA key. So to change this i'm following steps in Released Management->App Sigining on my play console.
I have downloaded PEPK tool but for step 2 I have command
$ java -jar pepk.jar --keystore=foo.keystore --alias=foo --output=encrypted_private_key_path
I dont know what is foo.keystore, foo and encrypted_private_key_path
can any one please help me on this?.
While working with any of the APIs related to Google Developer Console in Android, you need to configure two different SHA1 keys, i.e. one for debug and one for release. It happens most of the times that, we forget to to generate the SHA1 key for release version. I believe following link will help you to generate SHA1 keys for both the versions.
SHA1 Key for DEBUG & RELEASE ANDROID STUDIO MAC
If you are using Google Play Signing to allow Google Play to sign the release version of your app for you, then you will need to register the SHA1 key from the release version of your app with the authentication console. You can get this key following the instructions here:
https://support.google.com/googleplay/android-developer/answer/7384423?hl=en-GB
"If your app uses any API, you will usually need to register the certificate of the key Google signs your app with for authentication purposes. This is usually done through the fingerprint of the certificate.
To find the certificate of the key Google uses to re-sign your APK for delivery:
Sign in to your Play Console.
Select an app.
On the left menu, click Release management > App signing.
From this page, you can copy the most common fingerprints (MD5, SHA-1 and SHA-256) of your app signing certificate. If the API provider requires a different type of fingerprint, you can also download the original certificate in DER format and run it through the transformation tools that the API provider requires."
I want to generate and use a google API key.
enabled google maps v2 API
created project with one activity with google map (default wizard in studio)
created key on google for debug project, assigned SHA1;app package of application to the project key on google
API key inserted into google_maps_api.xml (AndroidManifest.xml updated automaticaly)
build & run on AVD on which the app is working, map is shown.
Then:
API already enabled
in Android studio created keystore for release (keystore.rel.jks)
generated fingerprints (keytool -list -v -keystore C:\Dropbox\AndroidKeyStore\keystore.rel.jks)
on google added new fingerprint to the new release project (release SHA1;app package) - key generated AIza...
API key inserted into google_maps_api.xml (AndroidManifest.xml updated automatically)
generate signed app (using keystore.rel.jks) & install on real device ... app is working, map is STILL BLANK, only zoom buttons and Google label is on
Make sure you enter your release API key in the google_maps_api.xml under the release folder.
First, switch to Project view by using the dropdown in the upper left of the Project Explorer. Then, expand app/src/, and you will see subfolders debug and release. Under there, you should see two separate google_maps_api.xml files under debug/res/values and release/res/values.
Make sure that the release API key is in the google_maps_api.xml file under the release/res/values folder, since this is the one that will be used for the signed release apk.
i was tired of trying over and over again, it turns out that PlayStore has something called App signing certificate, and the map works after i copy that sha1 and paste it in the google console for the android map.
When you try to create map api key please make sure the url contain correct package name. It should not take any sub package like this.
wrong package :com.gpslocation.trackerpro.Activities
correct package :com.gpslocation.trackerpro
After editing don't forget to save
Go to https://play.google.com/apps/publish/ and then to App signing:
Maybe you will see this:
If that is the case, maybe you are a developer and not the account owner. You will have to contact the account owner and ask him/her to complete that process. Follow this article about how to do that:
https://learnfreecoding.com/how-to-sign-your-android-app-with-signed-key-private_key-pepk/
The account owner will get to this screen:
Ask them to choose Upload a key exported from Android Studio. They will have to upload a private_key.pepk file. This is how you get that file from Android Studio:
Go to Build > Generate Signed Bundle / APK....
Select Android App Bundle and click Next:
Provide the corresponding credentials and make sure to put the check on for Export encrypted key for enrolling published apps in Google Play App Signing.
Specify the destination folder and make sure you select release before you click Finish:
That will generate the private_key.pepk file that you need to provide to Upload a key exported from Android Studio.
After doing the above, when you to to the App signing section of your app, you will see something like this:
Then you will see the Google Maps working correctly on real Android Studio physical devices and not only on the Android Studio Emulator. This was the solution for me.
generally you must do below steps:
1- Create New maps Activity in android studio
2- In google_maps_api.xml open the link in line 3
3- Confirm data and get key in Firebase
4- Copy key in google_maps_api.xml debug and release
5- Get release SHA1 in gradle tab -> signing report
useful link for get sha1
useful link for sign application in debug mode to get sha1
Make sure you enable the Maps for Android app in Google Console.
Make sure the map key you entered in google_maps_api.xml file is the same android key, generated by google console.
You can also try a new key.
Got stuck on this issue for a day. I tried everything and eventually found the following code in my manifest:
<supports-screens
android:anyDensity="false"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="false"
android:xlargeScreens="true" />
After removing these lines my maps displayed correctly.
I faced the same problem, in my case fingerprint of my package used in google map API key was mismatched so what i did:
Create a new google map activity.
Go to google_maps_api.xml.
Copy the link given in that file in paste in browser(login to google account).
On google create some project here and press continue
Click on create API key
Copy the key and paste in google_maps_api.xml
string name="google_maps_key" templateMergeStrategy="preserve" translatable="false"YOUR KEY HERE
And execute the application
Do not use below fingerprint, or key, create your separate it is based on package ans application
Please follow these steps:
Go to Google Play Console -> Setup -> App integrity -> App signing key certificate
Copy the SHA-1 certificate fingerprint
Open Google Cloud Platform
Go to APIs & Services -> Credentials
Click on your API key
Go to Application restrictions -> Restrict usage to your Android apps
Click on ADD AN ITEM
Add your package name with the copied SHA-1 certificate fingerprint
Wait for around 10 mins. and your maps would be visible on your published app.
I want to generate and use a google API key.
enabled google maps v2 API
created project with one activity with google map (default wizard in studio)
created key on google for debug project, assigned SHA1;app package of application to the project key on google
API key inserted into google_maps_api.xml (AndroidManifest.xml updated automaticaly)
build & run on AVD on which the app is working, map is shown.
Then:
API already enabled
in Android studio created keystore for release (keystore.rel.jks)
generated fingerprints (keytool -list -v -keystore C:\Dropbox\AndroidKeyStore\keystore.rel.jks)
on google added new fingerprint to the new release project (release SHA1;app package) - key generated AIza...
API key inserted into google_maps_api.xml (AndroidManifest.xml updated automatically)
generate signed app (using keystore.rel.jks) & install on real device ... app is working, map is STILL BLANK, only zoom buttons and Google label is on
Make sure you enter your release API key in the google_maps_api.xml under the release folder.
First, switch to Project view by using the dropdown in the upper left of the Project Explorer. Then, expand app/src/, and you will see subfolders debug and release. Under there, you should see two separate google_maps_api.xml files under debug/res/values and release/res/values.
Make sure that the release API key is in the google_maps_api.xml file under the release/res/values folder, since this is the one that will be used for the signed release apk.
i was tired of trying over and over again, it turns out that PlayStore has something called App signing certificate, and the map works after i copy that sha1 and paste it in the google console for the android map.
When you try to create map api key please make sure the url contain correct package name. It should not take any sub package like this.
wrong package :com.gpslocation.trackerpro.Activities
correct package :com.gpslocation.trackerpro
After editing don't forget to save
Go to https://play.google.com/apps/publish/ and then to App signing:
Maybe you will see this:
If that is the case, maybe you are a developer and not the account owner. You will have to contact the account owner and ask him/her to complete that process. Follow this article about how to do that:
https://learnfreecoding.com/how-to-sign-your-android-app-with-signed-key-private_key-pepk/
The account owner will get to this screen:
Ask them to choose Upload a key exported from Android Studio. They will have to upload a private_key.pepk file. This is how you get that file from Android Studio:
Go to Build > Generate Signed Bundle / APK....
Select Android App Bundle and click Next:
Provide the corresponding credentials and make sure to put the check on for Export encrypted key for enrolling published apps in Google Play App Signing.
Specify the destination folder and make sure you select release before you click Finish:
That will generate the private_key.pepk file that you need to provide to Upload a key exported from Android Studio.
After doing the above, when you to to the App signing section of your app, you will see something like this:
Then you will see the Google Maps working correctly on real Android Studio physical devices and not only on the Android Studio Emulator. This was the solution for me.
generally you must do below steps:
1- Create New maps Activity in android studio
2- In google_maps_api.xml open the link in line 3
3- Confirm data and get key in Firebase
4- Copy key in google_maps_api.xml debug and release
5- Get release SHA1 in gradle tab -> signing report
useful link for get sha1
useful link for sign application in debug mode to get sha1
Make sure you enable the Maps for Android app in Google Console.
Make sure the map key you entered in google_maps_api.xml file is the same android key, generated by google console.
You can also try a new key.
Got stuck on this issue for a day. I tried everything and eventually found the following code in my manifest:
<supports-screens
android:anyDensity="false"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="false"
android:xlargeScreens="true" />
After removing these lines my maps displayed correctly.
I faced the same problem, in my case fingerprint of my package used in google map API key was mismatched so what i did:
Create a new google map activity.
Go to google_maps_api.xml.
Copy the link given in that file in paste in browser(login to google account).
On google create some project here and press continue
Click on create API key
Copy the key and paste in google_maps_api.xml
string name="google_maps_key" templateMergeStrategy="preserve" translatable="false"YOUR KEY HERE
And execute the application
Do not use below fingerprint, or key, create your separate it is based on package ans application
Please follow these steps:
Go to Google Play Console -> Setup -> App integrity -> App signing key certificate
Copy the SHA-1 certificate fingerprint
Open Google Cloud Platform
Go to APIs & Services -> Credentials
Click on your API key
Go to Application restrictions -> Restrict usage to your Android apps
Click on ADD AN ITEM
Add your package name with the copied SHA-1 certificate fingerprint
Wait for around 10 mins. and your maps would be visible on your published app.
I want to generate and use a google API key.
enabled google maps v2 API
created project with one activity with google map (default wizard in studio)
created key on google for debug project, assigned SHA1;app package of application to the project key on google
API key inserted into google_maps_api.xml (AndroidManifest.xml updated automaticaly)
build & run on AVD on which the app is working, map is shown.
Then:
API already enabled
in Android studio created keystore for release (keystore.rel.jks)
generated fingerprints (keytool -list -v -keystore C:\Dropbox\AndroidKeyStore\keystore.rel.jks)
on google added new fingerprint to the new release project (release SHA1;app package) - key generated AIza...
API key inserted into google_maps_api.xml (AndroidManifest.xml updated automatically)
generate signed app (using keystore.rel.jks) & install on real device ... app is working, map is STILL BLANK, only zoom buttons and Google label is on
Make sure you enter your release API key in the google_maps_api.xml under the release folder.
First, switch to Project view by using the dropdown in the upper left of the Project Explorer. Then, expand app/src/, and you will see subfolders debug and release. Under there, you should see two separate google_maps_api.xml files under debug/res/values and release/res/values.
Make sure that the release API key is in the google_maps_api.xml file under the release/res/values folder, since this is the one that will be used for the signed release apk.
i was tired of trying over and over again, it turns out that PlayStore has something called App signing certificate, and the map works after i copy that sha1 and paste it in the google console for the android map.
When you try to create map api key please make sure the url contain correct package name. It should not take any sub package like this.
wrong package :com.gpslocation.trackerpro.Activities
correct package :com.gpslocation.trackerpro
After editing don't forget to save
Go to https://play.google.com/apps/publish/ and then to App signing:
Maybe you will see this:
If that is the case, maybe you are a developer and not the account owner. You will have to contact the account owner and ask him/her to complete that process. Follow this article about how to do that:
https://learnfreecoding.com/how-to-sign-your-android-app-with-signed-key-private_key-pepk/
The account owner will get to this screen:
Ask them to choose Upload a key exported from Android Studio. They will have to upload a private_key.pepk file. This is how you get that file from Android Studio:
Go to Build > Generate Signed Bundle / APK....
Select Android App Bundle and click Next:
Provide the corresponding credentials and make sure to put the check on for Export encrypted key for enrolling published apps in Google Play App Signing.
Specify the destination folder and make sure you select release before you click Finish:
That will generate the private_key.pepk file that you need to provide to Upload a key exported from Android Studio.
After doing the above, when you to to the App signing section of your app, you will see something like this:
Then you will see the Google Maps working correctly on real Android Studio physical devices and not only on the Android Studio Emulator. This was the solution for me.
generally you must do below steps:
1- Create New maps Activity in android studio
2- In google_maps_api.xml open the link in line 3
3- Confirm data and get key in Firebase
4- Copy key in google_maps_api.xml debug and release
5- Get release SHA1 in gradle tab -> signing report
useful link for get sha1
useful link for sign application in debug mode to get sha1
Make sure you enable the Maps for Android app in Google Console.
Make sure the map key you entered in google_maps_api.xml file is the same android key, generated by google console.
You can also try a new key.
Got stuck on this issue for a day. I tried everything and eventually found the following code in my manifest:
<supports-screens
android:anyDensity="false"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="false"
android:xlargeScreens="true" />
After removing these lines my maps displayed correctly.
I faced the same problem, in my case fingerprint of my package used in google map API key was mismatched so what i did:
Create a new google map activity.
Go to google_maps_api.xml.
Copy the link given in that file in paste in browser(login to google account).
On google create some project here and press continue
Click on create API key
Copy the key and paste in google_maps_api.xml
string name="google_maps_key" templateMergeStrategy="preserve" translatable="false"YOUR KEY HERE
And execute the application
Do not use below fingerprint, or key, create your separate it is based on package ans application
Please follow these steps:
Go to Google Play Console -> Setup -> App integrity -> App signing key certificate
Copy the SHA-1 certificate fingerprint
Open Google Cloud Platform
Go to APIs & Services -> Credentials
Click on your API key
Go to Application restrictions -> Restrict usage to your Android apps
Click on ADD AN ITEM
Add your package name with the copied SHA-1 certificate fingerprint
Wait for around 10 mins. and your maps would be visible on your published app.
I have a problem with Google Maps api v2 on my android app.
I have generated the key for the debug certificate and everything works fine, but I can't make it work with the release certificate.
I've generated the key and the alias with eclipse, then I took the SHA1 which eclipse shows at the end of the "Export signed application" process.
Then I generated the api key for android apps in my google api console using
SHA1;package name
But it doesn't work... it works only with the debug key generated in the same way, only using the sha1 of the debug certificate!
Please help me, otherwise I can't release my app
Check your manifest file, I guess you've forgotten to set your release map api key there while exporting with your release key?
Me too faced the same problem during releasing my app to google Play, when I used Google Maps V2 in my app. After succeeding the issue, I wrote a blog post regarding this you can have a look.
As everyone requested, I would say the answer in following steps
1) Sign up your app using eclipse adt
2) Note down the SHA1 finger print which will be displayed at console of your eclipse adt
3) Again go to google console and get API_KEY for your app by using above got SHA1 fingerprint
4) Replace the old API_KEY with the new API_KEY on to manifest.xml of your app
5) Again sign up your app. Your app is ready to be published. But keep in mind that once you published your app to google market, you should be able to release updates to your app by signing .apk using the keystore which you used earlier for release.
Hope this helps ...
There are two files google maps api.xml, one is the debug and release the other, then you should replace the key generated on google website console and enter this file, another outlet is inserted directly into the manifest.