Google maps v2 uthorization failure, could not contact google server - android

I trying to build a simple pedestrian dead reckoniing app using google map v2. But always got error 'Authorization failure' and 'could not contact google server'. I already check the api key, enable the 'Google Maps Android v2' service in Google API console, and allow my apps to use the API. but still not work.
Here's my manifest :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.pdr"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<permission
android:name="com.example.pdr.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.pdr.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_NETWORK_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"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.pdr.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.example.pdr.MapActivity"></activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyCu0QDFkPWOOAr0PACX2AUSSGkPWYmdpr0"/>
</application>
</manifest>
Here's the activity that using the map
public class MapActivity extends FragmentActivity {
private MapView map = null;
private GoogleMap gMap;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_menu);
setUpMapIfNeeded();
};
#Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
setUpMapIfNeeded();
}
private void setUpMapIfNeeded() {
if (gMap == null) {
gMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
.getMap();
}
}
private void setUpMap() {
gMap.addMarker(new MarkerOptions().position(new LatLng(0, 0)).title("Marker"));
}
}
And finally, here's the layout :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MapActivity" >
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
</RelativeLayout>
Can anybody please help me ? I've been struggling for days..
Thanks in advance, and sorry for my english...

This problem is related to your api-key generation process. Please follow below mentioned steps to generate key-
1. generate SHA-1 using keytool.
2. open google console on browser, dont forget to enable Google Maps Android API v2 from sevices, now go on API Access, click on create new Android key, paste your SHA-1 along with semi-colon and your project package name then click on create,
3. copy the new API-key and paste in your manifest.
4. Most important, dont forget to import google play service lib from extras folder of sdk if already installed, Otherwise go to Android sdk-manager -> extras->google play service, make it installed then import from your sdk location->extras->google-> google play service.
5. Now add this lib to your working project.
This is the whole process to execute google maps android v2.
Now you can run your project, cheers......

Related

FragmentActivity showing blank map on device, what could be the reason behind that?

My problem is that the google maps is not showing on my android device 2.3.0
I am new in android and i am trying to use google map in my app, i have downloaded google play services, also have added adndroidsupportv4.jar, i have generated api key by using sha1, after completing all steps map not yet visible on device, what could be the problem behind that, can any one help me. Even i have dowloaded google play services emulator shows an error that google play services not installed, so what i have made mistake while developing google map application
My code is:
below is the MainActivity class
package com.example.androdemo;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import android.os.Bundle;
import android.app.Activity;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
public class MainActivity extends FragmentActivity {
GoogleMap map;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
map =((SupportMapFragment)
(getSupportFragmentManager().findFragmentById(R.id.map) )).getMap();
// map.setMapType(GoogleMap.MAP_TYPE_HYBRID);
}
}
activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"/>
</LinearLayout>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.androdemo"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<permission
android:name="com.example.androdemo.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.androdemo.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.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.androdemo.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="AIzaSyB62caTnqcZoZil2lBc_qinUfNKNDmijRI"/>
</application>
</manifest>
i had the same issue, and the resolution was to generate a signed apk in order to view the map. i couldn't just view it on run or debug. had to be the signed application.
Another thing to check is that the internet is available on your android device.
I was developing an app that used google maps and they'd been working. I had no idea what was going on when suddenly they didn't appear. It turned out to be the lack of an internet connection that caused the problem!

Google Map not showing up in Android

1) It's showing empty map with grey color only with +(zoom in) and -(zoom out) buttons.
2) I extracted the SHA1 key from the debug.keystore and generated the MAP API V2 key in the
console.
3) I pasted that key in the manifest file.
4) GOOGLE MAP API V2 switched ON
and i use my Nexus 7 for debugging(USB Debugging)
LogCat Message :
Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network
errors).
Please help if i went somewhere wrong in these files.
AndoidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="metro.tailors"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17" />
<permission android:name="metro.tailors.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="metro.tailors.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="metro.tailors.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="metro.tailors.FactorsActivity"
android:label="#string/title_activity_factors" >
</activity>
<activity
android:name="metro.tailors.LadiesCategoryActivity"
android:label="#string/title_activity_ladies_category" >
</activity>
<activity
android:name="metro.tailors.GentsCategoryActivity"
android:label="#string/title_activity_gents_category" >
</activity>
<activity
android:name="metro.tailors.MapActivity"
android:label="#string/title_activity_map" >
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyA2pMJiaPfwlz2yKaRNMZHykQkY_******"/>
</application>
</manifest>
This the XML File of the MapActivity
<?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.MapFragment"/>
MapActivity.java
package metro.tailors;
import android.os.Bundle;
import android.app.Activity;
public class MapActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
}
}
4) GOOGLE MAP API V2 switched ON
You should turn on Google Maps for Android:
Fragment support start only from API > 11, So either change your manifest file to that or add android-support Library and use the SupportMapFragment object along side with FragmentActivity.
To download support library check the below link.
http://developer.android.com/tools/extras/support-library.html#Downloading
The doc states Use MapFragment class only if you are targeting API 12 and above. Otherwise, use SupportMapFragment.
https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/MapFragment.
regarding:
2) I extracted the SHA1 key from the debug.keystore and generated the MAP API V2 key in the console.
Not only do you have to do this, you also have to add your app to the list of allowed apps in the Google API Console, with your debug key and package name, as well as with your production keystore key and package name

Error in Google Map, "Failed to find provider info for com.google.android.gsf.gservices" and "Failed to find provider info for com.google.settings"

I have a serious problem in implementing a Google Maps fragment into my android app. Basically,
I followed all the instructions on Google's website. After obtaining a Google Maps API v2 key, setting up the layout and manifest, import the google-play-service library and initiating a GoogleMap using google's sample codes, I found out that the emulator didn't support Google Maps API v2, so I went online and download the newest version of com.android.vending.apk and com.google.android.gms.apk and then installed them into my emulator using adb install (same situation as in here: This app won't run unless you update Google Play Services (via Bazaar)). After installing them, I was finally able to implement an interface of a MapFragment.
But when I ran it in my Android emulator (OS 4.1.2; API 16), nothing in the map worked. An error saying "Failed to find provider info for com.google.android.gsf.gservices" kept coming out. I'm not sure if it has something to do with the wireless provider. Does anyone know why did it kept coming out? Any suggestion will be greatly appreciated!
To explain some of the earlier questions: the map showed up correctly. But the buttons on the map ("+" and "-") didn't work at all. Nor could I click or drag the map. Whenever I clicked any button, draged or double-clicked on the map, it gave me no response but error messages in the LogCat saying "Failed to find provider info for com.google.android.gsf.gservices".
Here is my code in AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.trackmyexercise"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="17" />
<permission
android:name="com.example.trackmyexercise.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.trackmyexercise.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.trackmyexercise.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="AIzaSyANkR-VPI4zy5IpYGK2Z0T1omLq3C46rFE" />
</application>
</manifest>
Here is my layout code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/hello_world" />
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/recordsButton"
android:layout_alignParentTop="true" />
</RelativeLayout>
And here is my MainActivity code:
package com.example.trackmyexercise;
import android.os.Bundle;
import android.app.Activity;
import android.app.FragmentTransaction;
import android.view.Menu;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
public class MainActivity extends Activity {
GoogleMap myMap;
MapFragment myMapFragment;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_activity);
myMapFragment = MapFragment.newInstance();
FragmentTransaction fragmentTransaction = getFragmentManager()
.beginTransaction();
fragmentTransaction.add(R.id.map, myMapFragment);
fragmentTransaction.commit();
myMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
this.setUpMapIfNeeded();
myMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
private void setUpMapIfNeeded() {
if (myMap == null) {
myMap = ((MapFragment) getFragmentManager().findFragmentById(
R.id.map)).getMap();
if (myMap != null) {
}
}
}
}
Error lies here --> android:name="com.example.tackmyexercise.permission.MAPS_RECEIVE"
Your package name is incorrect here, i suppose.
It should be "com.example.trackmyexercise.permission.MAPS_RECEIVE"
I followed the same tutorial, had the same problem as you, and managed to get a working Map by doing the following:
Right-click Project
Select 'Project Properties'
Select 'Android' on the left menu
Under 'Project Build Target' make sure you have 'Android X.X' selected (I'm using 4.2.2), NOT the Google APIs
Also make sure your Android Virtual Device has 'Android X.X' as a Target Version, NOT the Google APIs
Worked for me, hope it helps you!

Google maps in android gray grid

I'm trying to use mapviews in an app, so I followed the steps one by one. But I got just a gray grid. I generated the API key four times, but get the same result every time.
could you please help me?
These are the errors I got:
failed to find provider info for com.google.settings
couldn't get connection factory client
my manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.me.test.g_maps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="com.me.test.g_maps.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<permission
android:name="com.me.test.g_maps.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.me.test.g_maps.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="AIzaSyCEgLQ7HgXiKTP8grZRmpIPAeWoSfAjrBM"/>
<uses-library android:name="com.google.android.maps" />
</application>
</manifest>
my activity
package com.me.test.g_maps;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
public class MainActivity extends MapActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
#Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
my xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
android:id="#+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="AIzaSyCEgLQ7HgXiKTP8grZRmpIPAeWoSfAjrBM"
/>
</RelativeLayout>
As it looks you have few problems (in case your targeting Google Map API V2 technology)
1. First of all remove this permission:
<uses-library android:name="com.google.android.maps" />
It's a part of Google Maps API V1 and is not needed in Google Maps API V2.
2. Google Maps API V2 needs OpenGL-v2 support, and therefor you have to add the following to your manifest file:
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
3. Check that you are turning on the right API in the Google API Console:
4. Try to regenerate the key again, by deleting the debug.keystore, compiling a project and that will result in a new SHA1 signature.
5. If you run your application in the emulator, check this blog post I wrote on how to enable Google Map API V2 in the emulator:
Google Map API V2 in the Emulator
If you are using Google api V1, you have to create a debug key to load correctly the map when you are debugging the app without signing it.
Else, you have to take a look here. New configuration on manifest is needed to use google maps api V2.
Replace com.google.android.maps.MapView with com.google.android.gms.maps.MapView. You are still using parts of Maps API V1. And it's better (easier) to use SupportMapFragment instead of MapView.
And don't use MapActivity either.

Error while using Google maps version 2

Hey hai I am not able to get the maps loaded on my phone I get a error cannot open file for reading I have added google play service as library project; I have also added google play services jar to my project
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mapsdemo"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="15" />
<permission
android:name="com.example.mapsdemo.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.mapsdemo.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-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.mapsdemo.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="API KEY"/>
</application>
</manifest>
my main.xml 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="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment"/>
my MainActivity.java
package com.example.mapsdemo;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.app.Activity;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
When I run this on my galaxy s3 which has Android 4.0.4 The log cat gives me an error :
Log cat
01-25 20:11:45.690: E/(23663): Can't open file for reading
01-25 20:11:45.690: E/(23663): Can't open file for reading
Please help out with this
Oh my god..your "my MainActivity.java" is wrong. You did not write anything in it, so you get the failed. To display Google maps, AT LEAST your java code MUST include the following code, which is basic and initial settings;
1.**Modify your " **my MainActivity.java" such like as below;
This shows how to create a simple activity with a map and a marker on the map. Notice how we deal with the possibility that the Google Play services APK is not installed/enabled/updated on a user's device.
public class MainActivity extends android.support.v4.app.FragmentActivity {
private GoogleMap mMap;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.basic_demo);
setUpMapIfNeeded();
}
#Override
protected void onResume() {
super.onResume();
setUpMapIfNeeded();
}
private void setUpMapIfNeeded() {
// Do a null check to confirm that we have not already instantiated the map.
if (mMap == null) {
// Try to obtain the map from the SupportMapFragment.
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
.getMap();
// Check if we were successful in obtaining the map.
if (mMap != null) {
setUpMap();
}
}
}
private void setUpMap() {
mMap.addMarker(new MarkerOptions().position(new LatLng(0, 0)).title("Marker"));
}
}
2.**After modifying, press **ctrl+shft+ alphabet "o" on your keyboard and save it, Run again~!.
NOTE:Before you run, you MUST set the build target as "Googel APIs" in Android 4.0.3, NOT Android 4.0.3 in eclipse. Please check it; project < properties < Android < select "Googel APIs" under Android 4.0.3,
This error message is apparently a side-effect on the Samsung Galaxy S3 that occurs when you don't register the SHA-1 fingerprint of the digital certificate you're using to sign the Android application with the Google APIs console for the Android Maps API V2.
For example, I got this same error:
Log cat 01-25 20:11:45.690: E/(23663): Can't open file for reading
...after I switched to a new laptop and forgot to add the SHA-1 of the new debug certificate on that laptop to the Google APIs console.
To fix this on Windows for the debug certificate, open the command prompt, and then:
cd .android
keytool -list -alias androiddebugkey -keystore debug.keystore -storepass android -keypass android -v
This will print out a bunch of text, and you'll want to copy the text after the SHA-1: output.
Then, follow the instructions in the Android Maps API V2 documentation to add your SHA-1 fingerprint followed by a semicolon and your app package name to the Google APIs console.

Categories

Resources