My question is common, but I have tried all the suggestions listed before to solve the issue of that Google Maps only shown in debug mode not in release mode.
The below have been tried (for sure I have used the SHA-1 certificate fingerprint for debug keystore and release keystore as per google documents):
Added different api Keys in the google_map_api.xml for debug and
release.
Added same key for both debug and release modes.
Write the key manually in thee Manifest.xml
Refer to the string in the Manifest.xml
Update:
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<!--
The API key for Google Maps-based APIs.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<activity
android:name="local.application.user.myApp.MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Go to your Google api console where select the app and in left side :
Release management=> App Signing=> copy SHA-1 certificate inside App signing certificatemodule and paste into the Google cloud console and add this SHA1 with your project and save it . it will work . it works me.
After trying all suggested solutions (Thx for everyone). I tried to disable the Google Maps Api and re-enabled it again (from console.developers.google.co) and it has been working fine since then.
Related
The app debug works fine but in the release doesnt work.
Here is the AndroidManifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.poldevs.pabloelmapas">
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyCPHx0_******"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.AppCompat.NoActionBar">
<activity android:name=".ChatGlobalActivity"></activity>
<activity android:name=".fotoperfil" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<activity
android:name=".MapsActivity"
android:label="#string/title_activity_maps" />
<activity android:name=".ChatActivity" />
<activity android:name=".Mapa_Activity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I hava tried creating different API keys from google, both works on debug version but not in release, the map doesnt load.
Also I have a key for the debug version and another key for the release version (I have tried with the same key but still not working.
Have you generated the release key for google map. follow this link to generate a release key for google map.
Before publishing application into play store you have to follow some step to create release key with your app signing keystore.
An app that works in debug mode but not release mode can sometimes indicate a proguard problem. Did you try disabling proguard in build.gradle?
buildTypes {
release {
minifyEnabled false
}
}
If the app works with this change, then you'll need to modify your proguard config file.
I am trying to create a google maps activity using the google maps api in android studio. I generated the API key and pasted it in the google_maps_api.xml`. My manifest file is:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.l5434.project">
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<permission android:name="com.example.l5434.project" android:protectionLevel="signature"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<activity
android:name="pubsub.subscriber.MapsActivity"
android:label="#string/title_activity_maps"></activity>
<activity android:name="pubsub.subscriber.SubscriberActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I also added the dependency compile 'com.google.android.gms:play-services-maps:+' in my build.gradle but it didn't solve the problem.
This is how the emulator looks when the maps activity starts.
Do you know what's wrong?
This problem is usually related to the map API key used to sign manifest. Take a look at this post and this one which describe the same error you are experiencing. In both cases it is because the API key they used was created with the wrong keystore. You need to make sure you use your debug keystore when you create an API key in the Google API console
I'm having issues with google maps, I have got it working with the debug key but when try the release version, I'm getting a blank screen instead of the map. I've followed instructions and signed the release key.
C:\Program Files\Java\jre1.8.0_25\bin>keytool
-list -v -keystore C:\DecSurfApp\key.jks
Gives me this key:
SHA1: B6:1F:24:AB:##:8A:C9:EF:C9:##:##:##:##:##:##:##:##:##:##:##
Which I've used to generate api key
B6:1F:24:AB:##:8A:C9:EF:C9:##:##:##:##:##:##:##:##:##:##:##;
com.nitinarya.surfalarmclockrelease
What am I doing wrong?
Edit: Added AndridManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but are recommended.
-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="#string/google_maps_key" />
<activity
android:name="com.nitinarya.surfalarmclockrelease.MapsActivity"
android:label="#string/title_activity_maps" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
google_maps_api.xml
<resources>
<string name="google_maps_key_instructions" templateMergeStrategy="replace"><!--
Once you have your key (it starts with "AIza"), replace the "google_maps_key"
string in this file.
--></string>
<string name="google_maps_key" templateMergeStrategy="preserve">####################3PvXCg</string>
I think there is a problem with wrong Google API key. So you need to use SHA fingerprint while you are going to release your app.
For example , after final deployment of your application you can able to find SHA finger print while you'r going to finish (generate apk) so use that SHA finger print and generate google map key and add it to your manifest file and run once. After that just release your apk and deploy it. It will show you google map.
NOTE: Also check that you have added all necessary information to your Androidmanifest.xml file.
I've been developing my first android app using Google Maps SDK.
It work perfectly fine when i Run the application with Android Studio using my Samsung Galaxy S4. I can see maps, everything is good.
Now today, i released, and i testet it on my friends Samsung Galaxy s4. It did not show any maps. What a nightmare. What must i do? What information do i need to provide so someone can help me out?
Edit:
I signed my apk with android studio. It create some .jks file.
Here is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<permission
android:name="de.christianbergau.gojogging.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="de.christianbergau.gojogging.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:debuggable="false"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="MYAPIKEYHERE" />
<activity
android:name="de.christianbergau.gojogging.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="de.christianbergau.gojogging.SessionsActivity"
android:label="#string/title_activity_sessions" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.christianbergau.gojogging.MainActivity" />
</activity>
<activity
android:name="de.christianbergau.gojogging.MapActivity"
android:label="#string/title_activity_map" >
</activity>
<activity
android:name="de.christianbergau.gojogging.SettingsActivity"
android:label="#string/title_activity_settings" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="de.christianbergau.gojogging.MainActivity" />
</activity>
</application>
You were all right, this is what i did:
I did create an API Key with my debug.keystore SHA1 fingerprint.
I did create an APK file and signed it with my .jks file which android studio did create for me
I did deploy that APK and Maps could not be displayed
To fix it:
Get the SHA1 fingerprint of the jks file with the following command:
keytool -v -list -keystore /path/to/my.jks
Created new API Key on Google
Saved new API key to my manifest.xml
Upload new APK
Done
When you run app with Android Studio, your app use debug.keystore. Map work because map key generated for debug.keystore. You must generate api key for your release keystore.
When you publish your app with debug key, map looks blank. Use release key for production.
You can check this.
Google Map Android API v2 can't display map in play store application
I have an app that I have created that uses the Google Maps and Google Playstore and in debug using Eclipse and the Android SDK the map shows up on the device I am running but when released it doesn't show up on the app. Theres just a big grey screen.
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.eema"
android:versionCode="5"
android:versionName="5" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="10" />
<permission
android:name="com.eema.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.eema" />
<uses-permission android:name="com.eema.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!--
The following two permissions are not required to use
Google Maps Android API v2, but are recommended.
-->
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
<activity
android:name="com.eema.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.eema.MapViewActivity"
android:label="#string/title_activity_map_view" >
</activity>
<activity
android:name="com.eema.NoConnectionActivity"
android:label="#string/title_activity_no_connection" >
</activity>
<activity
android:name="com.eema.ShelterActivity"
android:label="#string/title_activity_shelter" >
</activity>
<activity
android:name="com.eema.FuelStopActivity"
android:label="#string/title_activity_fuel_stop" >
</activity>
<activity
android:name="com.eema.DirectionsActivity"
android:label="#string/title_activity_directions" >
</activity>
<activity
android:name="com.eema.EvacRouteTableActivity"
android:label="#string/title_activity_evac_route_table" >
</activity>
</application>
</manifest>
Could it be the Keystore. I have a release keystore file that was generated do I need to get the keystore from that if so how?
Are you just seeing gray screen then... it's almost definitely the API key that is wrong. The Emulator uses the debug keystore, with androiddebugkey, so you should create an API key for that. Remember to change it when you publish the app to the market
refer this
When U make your apk file. U need create a keystore. Now, using that keystore to get MD5 using "Keytool", like you did with debug keystore. After that, U need to register API key from MD5, you just got. And late, U use API key in your android manifest.
I assume it is a keystore problem.
Get the SHA1 from the keystore using the "keytool"
And register it like you did with the debug keystore.
And you are good to go.