Google maps not showing on android in release mode - android

I am trying to release my app, but having a problem with google maps.
The app contains an activity (MapActivity) that displays a map. When running in debug mode, the map works fine.
I signed my app in release mode, and got SHA1.
I created a new android key on Google console as required (SHA1;packageName). Got the API Key
In my App, I referenced a copy of google-play-services-lib as required.
I am using ADT.
map.xml
<?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" />
MapActivity.java
public class MapActivity extends FragmentActivity {
private GoogleMap map;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
.getMap();
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.rentalcar"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<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_NETWORK_STATE" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<permission
android:name="com.example.rentalcar.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.rentalcar.permission.MAPS_RECEIVE"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
>
<activity
android:name="com.example.rentalcar.MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.rentalcar.MapActivity"
android:label="#string/title_activity_map"
android:screenOrientation="portrait" >
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="My_Key"/>
</application>
</manifest>
The only weird thing is that when I use keytool to get SHA1 I get "Signature Algorithm name: SHA256withRSA. can this be the problem? If yes, how can I change it?
I am kind of stuck here! Thank you for any help!

if you already tried #Budius answer and still facing this error, it might be caused by the following situation:
When you add your MapFragment, Android Studio create 2 files google_maps_api.xml: one inside src/debug/res/values folder and the other inside src/release/res/values.
But for some reason only the debug folder file is showed on Android Studio. So, when you change the APIkey value, it is done only at debug folder file.
So just copy the google_maps_api.xml file to release folder and assure that both are with same APIKey.
this worked for me after all other attempts.

in the map API V2, the ONLY thing that change between a release version and a debug version is the Key that you register here https://code.google.com/apis/console/
If debug is working and final release is not, it's the only change necessary.
So I suggest you to double check the hash code of your release keystore and make sure that it's properly input on the Google API Console.

I was also facing the same problem since last few days and it took me around 2-3 days to figure out the problem.
You need to add your API key at 2 places one in
app/src/debug/res/values/google_maps_api.xml and other in app/src/release/res/values/google_maps_api.xml.
You can find the release/google_maps_api.xml in the project mode not in the Android/application mode.

I had the same problem... I've found the gogole_maps_api.xml file into the release/res/values folder... But inside the API_KEY was empty!!!!
After copying the API key also here, all works perfectly in debug mode and also in release!!
Thanks Sumit Sinha for suggestions

I'm facing same problem,
map work on debug but it's not working on Google Play Store
Try this:
I solved by add SHA1 key from Google play store to APIkey google maps console
or you can open this:
https://github.com/react-native-maps/react-native-maps/issues/327

Just clear data (Setting->App-select app-Clear data->uninstall) and try. this worked for me.
Ensure that package name is same as that in google developer console.
if you are created SHA1 code from custom keystore use the same in release mode. or generate apk by signing with that same keystore.

1- Create apk file using "Use the export Wizard" in "Android Manifest" file of your project.
2- After inserting key and before finishing, MD5 and SHA1 keys are shown as shown is this given pic-
3- Create new API Key for Android project for new SHA1 which is retrieved in point 2.
4- Use that API key in manifest file as shown below
5- Clean your project and build APK file again.
6- You can see google maps now in that apk.

I was following everything yet was not able to get it done, the thing I was doing wrong is that
I was initially **checking ** both V1 and V2 signature versions.
Solution: Just check the V1 Signature

It's been a while, but I've found a very easy solution.
Just set gradle like this:
buildTypes {
release {
isMinifyEnabled = false
isShrinkResources = false
}
}

Related

Authorization failure while loading google maps v2 android

I am making an android app with google maps:-
My steps:-
Main activity extends Fragment activity
Made a copy of Google play services library and imported it to eclipse.Further added a reference of the library to the project.
Enabled the build target of the project to Google API's 4.4.2
Created a browser key on Google API console.
Created an SHA1 certificate for the app in eclipse using the keytool plugin(Also verifies the key using the traditional command prompt technique and both match).
Created an android Api key on Google API console using the SHA1 key obtained
Issue:- I get a blank map on the screen with the zoom in and zoom out buttons
Here is my code:-
activity_main.xml:-
<fragment
class="com.google.android.gms.maps.SupportMapFragment"
android:id="#+id/map"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/spr_place_type"
/>
AndroidManifest.xml :-
<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"/>
<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-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<permission
android:name="com.strangeworld.locations.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<uses-library
android:name="com.google.android.maps"/>
<activity
android:name="com.strangeworld.locatorapp.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>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyD2LVShEdbQWWV4......"/>
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
Log cat:-
01-10 10:33:28.059: E/dalvikvm(2440): Could not find class 'maps.ae.i', referenced from method maps.af.al.a
01-10 10:33:30.039: E/GooglePlayServicesUtil(2440): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
01-10 10:33:32.909: E/Google Maps Android API(2440): Authorization failure. Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
01-10 10:33:32.929: E/Google Maps Android API(2440): Ensure that the following correspond to what is in the API Console: Package Name: com.example.locations, API Key: AIzaSyAZhJllASbTnr......, Certificate Fingerprint: 83033D1ECACA2C88F9AA2.....
While generating the key do i need to spicify the whole package name i.e. com.abcdm.locatorapp or just com.abcdm
Yes you need to mention the package name in the google api console
SHA;complete packagename
Also try regenerating the key
The Google Play services resources were not found. Check your project configuration to ensure that the resources are included
You need to reference the google play servies properly. Check this
Importing google-play-service library showing a red X next to this reference android
Your keystore is not appropriate or package name mistake in google api console, recheck once.
Which type of keystore you are using? If you use debug key and published map looks blank. Use release key to publish.
Google Map Android API v2 can't display map in play store application
mention the entire package name with the key after semicolon ie. com.abcdm.locatorapp

Failed to load map. Error contacting Google servers issue with android google maps api v2 [duplicate]

This question already has answers here:
Failed to load map. Error contacting Google servers. This is probably an authentication issue
(25 answers)
Closed 8 years ago.
I have been trying to app a Google Map in my Android app using the v2 API for the past two days, with no success. All I get every time is a
Google Maps Android API(16603): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
I have followed Google's setup tutorial (https://developers.google.com/maps/documentation/android/start), tried multiple times with different projects in different workspaces, tried different Google accounts, gone through various answers and suggestions here in StackOverflow, but to no avail.
I am using Eclipse 4.2.2 with Android SDK Tools 22.01 and I have installed Google Play services (rev. 7), also I have imported google-play-services_lib into my workspace and added a reference to that to my android project.
Here is my code:
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.googlemapdemo"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<permission
android:name="com.example.googlemapdemo.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.googlemapdemo.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-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" >
<activity
android:name="com.example.googlemapdemo.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>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="my_api_key" />
</application>
</manifest>
activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="#+id/the_map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.SupportMapFragment"
/>
MainActivity.java
package com.example.googlemapdemo;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
public class MainActivity extends FragmentActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
Also I created an API Project on https://code.google.com/apis/console/ where I have enabled the Google Maps Android API v2 service. Then I obtained my SHA1 debug certificate fingerprint using
keytool -list -v -keystore "C:\Users\my_user_name\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
and entered that and the package name in the API console, got the API key and put it in the manifest (where my_api_key is). This procedure I repeated a number of times, regenerating the key but with the same result.
Could anyone help with this or suggest anything else I could try? Any help will be greatly appreciated!
Simple.
If you are sure that the API key is right, and this error still comes up Logcat,
then try this:
Uninstall app from device.
Clean the project
And run on device again
The map should now display on the device....this worked for me .. cheers :)
Found it after all, after turning off WiFi on the device I was using. It seems that when debugging over WiFi you also need the
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
in the manifest. Don't know if it was just my case or it's a general thing, but I guess it should be in the documentation somewhere (it's not).
So if you are reading this and having similar problems try either disabling WiFi or adding the above permission alongside the others.
Make sure you follow the instructions carefully in the documentation found at:
https://developers.google.com/maps/documentation/android/start#obtain_a_google_maps_api_key
As of the new ADT you should see an error message in the logcat viewer which gives you explicit instructions such as where to go, what to enable and the details you need to paste into the android fingerprint and app details. See below;
A few Gochas;
Enable BOTH Google Maps Android API v2 AND Google Play Android Developer API in the developer console! This got me :)
Make sure you are using the correct keystore to find the SHA1 hash
(this can be found by going to
window->preferences->android->build and look for SHA1) This will differ from your production keystore! Otherwise you can use keytool -list -v -keystore YOURKEYSTORE.keystore -alias YOURALIAS to view the SHA1
Add your elements INSIDE your tags
Add your elements INSIDE the <.manifest> tag (above the tag)
This permission solved the problem
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="my_api_key" />
android:value="my_api_key" should be an actual key that you get from https://code.google.com/apis/console
I ran into the same problem and found that this set of permissions works.
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
I think it is the problem of your API Key.
Try the Android Sample project for maps(Google play service) from new project.
and add your API key into maps AndroidManifest.xml file.
If it is not working then it will be the problem of API Key.
Just spend a few frustrating hours with this exact same issue.
Was trying to run the mapdemo application from Google. Generated new keys etc still would not run.
Simple solution as detailed above was to delete the app from the tablet and run again for eclipse. Problem went away.
In Eclipse: Window, Preferences, Android, Build, SHA1 fingerprint from the debug keystore is the value you need (this matches the Google documented way using Keytool form the command line).
The answer for my similar issue is to add:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Make sure the "Google Maps Android API v2" is enabled,
under Google APIs console, Services (see screenshot below.
If it's not enabled, you will not get an error saying the service is disabled
although you entered the SHA1 key.
Screenshot
just to say, I was sure that I did everything well, but I finally noticed that the name of the package in the project was not the same as the one declared in the AndroidManifest.xml, so not the same as in Google APIs console.
Guess what, I changed it and... tadaa it worked !
So for who comes here, check that too !
My solution was use the correct file
in my case i used debug.keystore in C:\Users\.android for generate SH1 KEY
after try meny times, a found anoter file in C:\Users\\Downloads\adt-bundle-windows-x86_64\adt-bundle-windows\sdk.android an use it, for generate SH1 Key
and then copy 45:B5:E4:6F:36:AD:0A:98:94:B4:02:66:2B:12:17:F2:56:26:A0:E0 values the api key site
All Work again
Make sure you have apk signed with right key
http://developer.android.com/tools/publishing/app-signing.html
I have found new Solution that was my silly mistake.
May you have changed you application package name after Google Map Integration.
One SHA1 certificate fingerprint and package name (separated by a semicolon) per line.
Example:
45:B5:E4:6F:36:AD:0A:98:94:B4:02:66:2B:12:17:F2:56:26:A0:E0;com.example
Check Google API Console
I have solved this kind of problem, i hope people who find the same problem with me(hopefully nobody else ever do the same mistake) will find this helpful
my cause was i made a mistake when i created the project, the package name was wrong then i changed the package name of the project, this will produce 2 applications with same name but different package name. starting from here the maps didnt work anymore. then even if i changed the server side google api key, it still wont work.
solution:
try to uninstall both of apps first then clean the solution. and the map shows up again.
After spending several hours and following every tip on stackoverflow, I made it work trying one last thing.
I wanted my Map to display in another activity which I call mapActivity not the mainActivity. so when I created the sh1 key in google console api I typed package name for my mapActivity.
!!BUT it always needs to be the package name of the main activity even though you don't display the map there, so = packagename.appname from mainactivity
Make sure that you are using the debug certificate fingerprint and not a release fingerprint in the Google Developers Console. Instructions on finding your debug key can be found here.

getting Failed to load map. Error contacting Google servers

I read all the post concering this issue and yet I wasnt able to solve it on my mechine.
I allways get:
06-23 20:04:30.011: E/Google Maps Android API(6623): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
when getting to the map activity.
my code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mobwal"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="14" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<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" />
<permission android:name="com.mobwal.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="com.mobwal.permission.MAPS_RECEIVE"/>
<uses-permission android:name="com.google.android.providers.gsf.permissions.READ_GSERVICES"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/logo1small"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="KEYFROM GOOGLES CONSOLE" />
<activity
android:name=".FacebookStart"
android:label="#string/app_name"
android:windowSoftInputMode="adjustResize" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.facebook.LoginActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
</application>
</manifest>
I got my SHA1 fingerprint from eclipse preferences and it is the same as I had using key tool. the thing is that I had two .android folders(one on C:\Users\user_name.android and on my android sdk folder) I delete the one on the user's after trying to activate my app using it (without success and now it is not recreated) so I got left only with the one under my android sdk folder which is not helping much.
I need help I tried almost anything.
Go to https://code.google.com/apis/console
Once logged in, go to Services > Google Maps Android API v2 and switch on this toggle button.
Careful: it's "Google Maps Android API v2" and not "Google Maps API v2".
For those to whom none of the answers work, in my case the problem was, that there was another android app key registered for the same package name on another account's console, so the maps api was finding that, and failed to authenticate me (obviously). As soon as that has been removed (and the fingerprints added to the one I was using) after removing and installing the app again on the phone everything started to work.
This is keystore issue on 99%.
1) I use for release and debug the same file debug.keystore which I copy from C:/Users/EEfimenko/.android/debug.keystore to C:\Users\EEfimenko\Android\MyApp\app folder for access directly like to debug.keystore without C:/Users/... link
2) Then I add point to it from build.gradle(Module: app) file inandroid`:
signingConfigs {
debug {
storeFile file('debug.keystore')
}
release {
storeFile file('debug.keystore')
}
}
3) Run keytool -list -v -keystore debug.keystore command from cmd from C:\Users\EEfimenko\Android\MyApp\app folder and mix resulted SHA1 fingerprint with name of applet: FR:TY:CG.....YF:ER;com.myapp.nameofit
4) Go to https://code.google.com/apis/console/b/0/?noredirect to:
a) Services and enable "Google Maps Android API v2" to ON state
b) Put FR:TY:CG.....YF:ER;com.myapp.nameofit in "API Access" like Create new Android Key
Now you can see your map with key again like at beginning without key!:)
I tried to do almost everything like generating the key for 20 times, changing the order of the permissions, but there is nothing batter than just removing the project from workspace and importing it back again.
Problem is: work without key, but doesn't work with it, because you touch "app" file by your hand from editor. You must edit it and make changes only from: File -> Project structure
You need to find file \app\src\release\res\values\google_maps_api.xml
in your project and place there your Google API KEY because Android Studio show you only google_maps_api.xml from debug folder for debug version. Than all will work and map will show not only in debug mode;)

Using Google Maps v2 in Android

i am trying to integrate Google Maps to my Android Application. I followed this tutorial: https://blog-emildesign.rhcloud.com/?p=435.
I did everything as suggested.
These are the errors in the error log:
E/Google Maps Android API(28238): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
E/Google Maps Android API(28238): Authorization failure. Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
E/Google Maps Android API(28238): Ensure that the following correspond to what is in the API Console: Package Name: com.example.kontrollen, API Key: xxxxxxxxxxxxxx, Certificate Fingerprint: xxxxxxxxxxxxxxxxxxxxxxx
And this is my google account:
Do you have any ideas what i can do?
This is my AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.kontrollen"
android:versionCode="1"
android:versionName="1.0" >
<permission android:name="com.example.kontrollen.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="com.example.kontrollen.permission.MAPS_RECEIVE"/>
<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"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxx" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.kontrollen.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>
</application>
</manifest>
I solved the problem by uninstalling the app and cleaning the project folder. I did not change anything. Thank you for your help.
follow the url to create your app google api key i have done this recently.. and it was successful.
https://code.google.com/apis/console/ ------------ For Google API
https://developers.google.com/maps/documentation/android/start ------------ Crate Map
read these page carefully every thing is given in this page .. follow the same but make sure you have generated correct SHA1 fingerprint
and when you are going to crate the app make sure run it on real device because it need google play services to run add google pay services in your application
Edited answer:
Try putting the meta-data within the application tag, preferably right before the closing tag like
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="xyz" />
</application>
Follow this steps to trace error youself
STEPS
for your error type
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
1.check for internet or gsf reader permissions in manifest as shown above.
2.check for the package name you used in you manifest.
3.check in your api console the service that you started is Google Maps Android API v2.
4.Check the library google play services is imported or not.
5.if no solution is working try out new way following this link-- https://developers.google.com/maps/documentation/android/start.
6.Also keytool command to generate sha1--i used is-
keytool -v -list -alias androiddebugkey -keystore C:/Users/username/.android/debug.keystore
I had actually made a maps activity from the studio and used the link it generated to set up the maps API. Where I went wrong was, I placed it inside a package and the package name that was registered for the app was with that folder name. For Ex.
If app package name is
com.awesome.shit
the package that was saved in API was
com.awesome.shit.maps
changed it and it started working.

Google MapFragment is blank (white) with Could not find class 'maps.j.k'

I'm trying to build the official android google map api v2 sample on a (gingerbread 2.3.5) phone .
I added android-support-v4.jar to official sample project.
I took the sample from the official tutorial in <android-sdk>/extras/google-play-services/samples/maps
I copied the sample app in Eclipse, reference the google-play-services_lib project as an Android library, and build the whole thing with the Android SDK 4.1.2 (api 16).
Unfortunately, ahen I launch the app the map is blank and I don't have any exception or message.
The only thing I got are those suspicious lines in the logcat :
Unable to resolve superclass of Lmaps/a/du; (411)
Link of class 'Lmaps/a/du;' failed
Unable to resolve superclass of Lmaps/a/ej; (2363)
Link of class 'Lmaps/a/ej;' failed
Unable to resolve superclass of Lmaps/j/k; (2379)
Link of class 'Lmaps/j/k;' failed
ERR Could not find class 'maps.j.k', referenced from method maps.y.ae.a
VFY: unable to resolve new-instance 3571 (Lmaps/j/k;) in Lmaps/y/ae;
I suspect that my project structure in eclipse 3.8 is somewhat messed up.
I tried the following things (even the most idiotic) to no avail.
1. Invalid api key ?
I generated a "debug.keystore" with keytool and updated the eclipse preference (Android/Build/Keystore).
Of course, I registered that new keystore/SHA1 and get a new api key that I used in the AndroidManifest file
2. Wrong project target ?
I tried to build my two projects with the following targets :
Android 4.2.1
Google Api 4.2.1
3. adding google-play-services_lib as a project dependency
I tried to add google-play-services_lib as a project dependency on top of being added as an android library in the demo build path.
And tick the matching export checkbox.
4. test google maps api v2 on the phone
I downloaded trulia real estate app that is said to use the v2 api on the phone to be sure that the phone is compatible with the new api
Here is the manifest for the sample app
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mapdemo"
android:versionCode="1"
android:versionName="1.0" >
<permission
android:name="com.example.mapdemo.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE" />
<!-- Copied from Google Maps Library/AndroidManifest.xml. -->
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!-- External storage for caching. -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- My Location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Maps API needs OpenGL ES 2.0. -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<!-- End of copy. -->
<application
android:hardwareAccelerated="true"
android:icon="#drawable/ic_launcher"
android:label="#string/demo_title" >
<!-- You must insert your own Google Maps for Android API v2 key in here. -->
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="XXXXXXXX" />
<activity android:name=".MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".BasicMapActivity"
android:label="#string/basic_map" />
<activity
android:name=".CameraDemoActivity"
android:label="#string/camera_demo" />
<activity
android:name=".EventsDemoActivity"
android:label="#string/events_demo" />
<activity
android:name=".GroundOverlayDemoActivity"
android:label="#string/groundoverlay_demo" />
<activity
android:name=".LayersDemoActivity"
android:label="#string/layers_demo" />
<activity
android:name=".LocationSourceDemoActivity"
android:label="#string/locationsource_demo" />
<activity
android:name=".MarkerDemoActivity"
android:label="#string/marker_demo" />
<activity
android:name=".OptionsDemoActivity"
android:label="#string/options_demo" />
<activity
android:name=".PolygonDemoActivity"
android:label="#string/polygon_demo" />
<activity
android:name=".PolylineDemoActivity"
android:label="#string/polyline_demo" />
<activity
android:name=".ProgrammaticDemoActivity"
android:label="#string/programmatic_demo" />
<activity
android:name=".TileOverlayDemoActivity"
android:label="#string/tile_overlay_demo" />
<activity
android:name=".UiSettingsDemoActivity"
android:label="#string/uisettings_demo" />
<activity
android:name=".RawMapViewDemoActivity"
android:label="#string/raw_mapview_demo" />
<activity
android:name=".RetainMapActivity"
android:label="#string/retain_map" />
<activity
android:name=".MultiMapDemoActivity"
android:label="#string/multi_map_demo" />
</application>
</manifest>
Here are some screenshots of my project structure/build path.
I think maybe you make something wrong when you apply the api KEY.
I have the same problem, and at last I found that I turn on the incorrect service. at https://code.google.com/apis/console/,
There are Google Maps API v2 and Google Maps Android API v2.
You should use Google Maps Android API v2.
I had exactly the same problem (all configurations the same, maps.j.k stuff in the logcat). However, for me choosing Google APIs as build target solved it. But that was Google APIs 4.2, so I suggest that you install the update and try with the more recent target.
I resolved this issue by changing de targetSdkVersion with de last targetSdkVersion avaiable, at the AndroiMainfest.xml file.
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
Are you using ProGuard? Usually class names like "a", "b", etc. are a result of ProGuard obfuscating class names, and maybe the Maps API breaks when that happens. If that's the case, you will either have to disable ProGuard or add some -keep lines to your proguard.cfg file. This post shows what those lines might look like.
In my case it was due to 2 issues
on my phone the latest Google Maps app was not installed (in fact there was no google maps at all)
I didnt have all the required permissions set in my manifest
<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"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
As documented in https://developers.google.com/maps/documentation/android/start#installing_the_google_maps_android_v2_api
http://developer.android.com/sdk/index.html --this is the link for the adt bundle in android..try downloading this and start over again..maybe there's a problem with your ADT.
Check the console API you've enabled Google Maps Android API v2
I was dealing with same issue. I tried to implement the com.example.mapdemo and had a heck of a time.
I copied the code of the BasicMapActivity to a clean new project and made the Libraries look as above.
Basically, I couldn't get either to work. I got the "Authorization failure" error in the debugger.
Then, today, I prepared new keys specifically for each project with the specific com.example.xxx after the semicolon when preparing the key in the Google Console.
I did Project->Clean at every step.
I ran it in debugger first, then just Run. And, if I remember, a few times after making the change to the manifest.
Then, finally, they worked. It seemed, in the end, to require a key for each specific project.
Here's what worked for me. When you use the Google APIs Console to create your API key, be sure to append ;com.example.mapdemo to the SHA1 fingerprint. (I was using something else more appropriate for another app I'm currently developing.) What clued me in on this solution was an authorization error in the LogCat.
In my case I added LocationSource Interface so I can get location data but i forgot to add :
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
at Manifest file.
Don't forget to use separate keys for debug and release version of the app!
If you have already tried everything, try to uninstall and reinstall again your app: on my phone (S3 mini), after the first launch with the wrong key, I corrected it, but it didn't work until a complete uninstallation.
Maybe some sort of caching is used.

Categories

Resources