I have an app that makes use of MapFragment and while I was developing the app the map worked perfectly fine.
I recently created a signed apk and uploaded my app to the app store for alpha testing. Since then the maps in app are not showing anything. The odd thing is that not only are maps not being shown in the release version, but when I run the app through android studio it's not showing there either.
I've added my SHA1 fingerprint from my keystore and still nothing working.
Here is some of my code:
<permission
android:name="com.k.myapp.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.k.myapp.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.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<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.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:protectionLevel="signature"
android:name="com.k.myapp.permission.C2D_MESSAGE" />
<uses-permission android:name="com.k.myapp.permission.C2D_MESSAGE" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:name=".myappApplication"
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
</activity>
<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="MY_ANDROID_API_KEY" />
My layout file - This layout displays the map in a small rectangle inside the activity
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:id="#+id/map_detail"
android:layout_width="match_parent"
android:layout_height="80dp"
map:cameraZoom="13"
map:mapType="normal"
map:liteMode="true"
tools:ignore="MissingPrefix"/>
My Activity:
SupportMapFragment fragment = (SupportMapFragment)
getSupportFragmentManager().findFragmentById(R.id.map_detail);
mGoogleMap = fragment.getMap();
markerOptions = new MarkerOptions();
markerOptions.position(latLng);
mGoogleMap.addMarker(markerOptions);
mGoogleMap.animateCamera(CameraUpdateFactory.newLatLng(latLng));
I also have google play services:
compile 'com.google.android.'
In addition to this I have an activity with a full screen map. This map randomly works for 1 of my users but not the rest. I don't think there is a problem with my code, but I've tried everything in terms of adding SHA1 fingerprints from my keystore. What's even more bizare to me is why the map isn't even working in development.
I ended up having a pair of keys in my manifest, one for production and the other for debug (as CSmsith suggested).
In case you don't know where to find your debug keystore, search your hard drive for debug.keystore.
Good luck!
Related
I've used google maps in my application since 8 month ago . I'm using eclipse. It works nice and every thing was ok. Now I find out that maps are not showing anymore , it shows the google icon and zoom icons too but it doesn't show the maps .
I went to new google developer console . https://console.developers.google.com and I enabled Google Maps Android API on the console , then I went to "credential" and regenerate a new key .
I change some codes in manifest , this is my manifest code :
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<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.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<permission
android:name="myapplication.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="ir.persiandesigners.jazebehayeiran2.MAPS_RECEIVE" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<!-- end map -->
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/CustomActionBarTheme" >
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="myApiKey" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
I export the app and installed it again but it doesn't work yet .
what should I do ? Why it is not working ?
by the way ,I'm having google play service lib verion 4.3.23 in the eclipse and I'm sure that I've installed google play service on my phone .
thanks
When you export the app did you use another key other than debug.keystore. Then you should generate the SHA1 key with the keystore file you used to export the app.
<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="your_API_key"/>
<meta-data android:name="com.google.android.gms.version"
android:value="google_play_services_system_key"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
"google_play_services_system_key" this will you get in your error when you run your code. this is your system key put that here.
Try to Open your SDK manager and Update the Google Play Services and Google Repository.
i have followed the google tutorial for using google maps and every thing is fine except that the map doesn't load prob on genymotion emulator
this is my mainfest
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<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"/>
<!-- The following two 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.geo.API_KEY"
android:value="*************************************"/>
<activity
and this is my layout
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
please respond asap !!!
If you are under developing your project, the API key which you are currently using must be generated from your PC's SHA key.
If it is fine, there could problem in your Play services. So, the Google Play Services must be in upto date.
Thanks!!
Though I know this has been a persistent and addressed issue, everyone's problem seems to be solved a different way every time. I have been trying to get my map to show all day but to no avail. I had a project which had a map in it, so what I migrated that project to another location and set up Google Play Services in that project. I got everything to work except for the map to show. I have the library as i am able to use LatLng but the map always fails to load. I have generated new keys, deleted and re added the key, and deleted and re added the debug keystore. I have also updated the api console to ensure everything lined up but my map still doesnt show. I have Google Map for Android Api enabled in the console. And my package name is correct also. I have ran a clean rebuild and uninstalled the app to see if it works but it still doesnt load.
NOTE: I have also tried using SupportMapFragment instead.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.wallfly"
android:largeHeap="true">
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.Actionbarstyle">
<activity
android:name="com.android.wallfly.MyActivity"
android:label="#string/app_name" >
</activity>
<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="(Actual API Key)" />
</application>
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<permission
android:name="com.android.wallfly.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.android.wallfly.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.WRITE_SETTINGS" />
<!-- these grant the app the ability to access location. coarse is wifi and cellular, fine is gps -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
I have added an image to show that my package name lines up. Also i copied and pasted the SHA1 fingerprint so I am sure that it does line up also.
For those who may face a similar problem, my google play service was outdated. So I had to change the build.gradle the current version of google play service.
I have Developed an application that have Google Map functionality so i use new google play services library but when i launch Google map activity its showing map but blank so what is wrong with my code
my manifest file xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.apa"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="18" />
<permission
android:name="com.example.apa.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<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.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<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" />
<uses-library android:name="com.google.android.maps" />
<application
android:debuggable="false"
android:allowBackup="true"
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:theme="#style/Theme.AppCompat.Light">
<activity
android:name="***************"
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="*****.*****.***.ViewOnMap"
android:label="#string/title_activity_view_on_map" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value=*********************************" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
layout file
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
class="com.google.android.gms.maps.SupportMapFragment"
android:name="com.google.android.gms.maps.MapFragment" />
activity file
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_on_map);
Global.startAppAd.loadAd();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
fm = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
}
LogCat error
Google Maps Android API﹕ Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
Check your API key carefully
Check your SHA key carefully
You should be connected to internet using WIFI before first time using Google map and wait 2-3 min till download map data etc. next time no need to connected with internet but if u want to search another location it must also be connected with internet using WIFI .
By seeing the LogCat error
Google Maps Android API﹕ Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
it seams its problem with Authentication. and Code should have
googleMap = fm.getMap();
// Getting reference to the SupportMapFragment of activity_main.xml
SupportMapFragment fm = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
// Getting GoogleMap object from the fragment
googleMap = fm.getMap();
Try to use this... And Double check SHA1 key
EDIT :
Check Phone Location settings also..
Try these:
Google Play Services:
You have to download the latest Google Play Services
com.android.vending-4.8.20.apk.In that site if google play
services wasn't working means you can find a lot of sites in
internet named com.android.vending 4.8.20.apk.
you can run the Google play Services by using the Command Prompt
adb install com.android.vending 4.8.20.apk.
Note: You have to download the latest Google play services because year by year latest version will be updated in internet.
I've been working on an android app for the past little while and I wanted to set it up to connect to Google Maps. I've been writing it inside Eclipse with the ADT plugins. I followed this tutorial but I've been getting the following Error when I try to load maps.
"failed to load map. error contacting google servers. this is probably an authentication issue (but could be do to network errors)"
Since I can access google maps in other apps it has to be an authentication error. I've tried uninstalling the app from my phone but that does not fix the error.
The SHA1 that eclipse is using (according to window > properties > android > build) is 58:EF:6F:DE:DE:B4:4E:EB:20:15:68:39:08:5D:87:32:FE:20:99:99
I used this to generate an API key in the google console which you can see contained below in my manifest file. The app I specified in the console was 58:EF:6F:DE:DE:B4:4E:EB:20:15:68:39:08:5D:87:32:FE:20:99:99;com.example.test. It may be worth noting that I'm loading the map inside an activity located in the gui package, not the com.example.test package that contains MainActivity.
I've been testing this on my nexus 5 by clicking play in eclipse while the phone is plugged into my computer.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="19" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<permission
android:name="com.example.test.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<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="AIzaSyBsTBliiyhE2G4Navzfc1ANeI9f7JwAtEM" />
<activity
android:name="com.example.test.MainActivity"
android:label="#string/app_name" >
</activity>
<activity
android:name="gui.SetLocationActivity"
android:label="#string/title_activity_set_location" >
</activity>
</manifest>