I did the things described in this article:
When the application starts on real device HTC Desire 500 Dual, Android version 4.1.2 is not shown google map. Showing a black screen with the logo of google and inactive "+" and "-".
I use this files:
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="gogo008.kermi.geo.v2"
android:versionCode="1"
android:versionName="1.0">
<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:label="#string/app_name" android:icon="#drawable/ic_launcher">
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
<activity android:name="KermiGeo_v2"
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="AIzaSyCTNkkaXiTHasvFzrHek1RYMj4AzoUHIeA"/>
</application>
</manifest>
res/layout/main.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.MapFragment"/>
src/gogo008/kermi/geo/v2/KermiGeo_v2.java
package gogo008.kermi.geo.v2;
import android.app.Activity;
import android.os.Bundle;
public class KermiGeo_v2 extends Activity
{
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
Info from google console is:
Key for Android apps (with certificates)
API key: AIzaSyCTNkkaXiTHasvFzrHek1RYMj4AzoUHIeA
I usе debug certificate fingerprint.
Can anyone help me?
Check DDMS for errors. I found using DDMS the correct SHA1 hash and package name to be used in google console android maps setup.
Related
I build a project by following all the steps provided by Google on its developer's page. The project won't run on my android device running 2.3.7. However, it runs on the eclipse emulator running API level 19. Here's the code for manifest, xml and Java.
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.googmaps"
android:versionCode="1"
android:versionName="1.0" >
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<!-- OpenGL reference -->
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
<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" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<!-- GooglePaly Services Reference -->
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name="com.example.googmaps.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>
<!-- Key Reference -->
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="i don't want to paste the key here. but there is no prob with it" />
</application>
</manifest>
Here is the code for 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.MapFragment"/>
Here is the code for Java
package my.package;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
Please note again that the application runs on the emulator with API 19.
Appreciating help.
Change this
public class MainActivity extends Activity {
to
public class MainActivity extends FragmentActivity {
and this
android:name="com.google.android.gms.maps.MapFragment"/>
to
android:name="com.google.android.gms.maps.SupportMapFragment"/>
Your min sdk is 10. So you need to use SupportMapFragment in which case you need to extend FragmentActivity.
Use MapFragment above api level 11
Note: Test it on a real device which has google play services installed on it. Android 4.2.2 (API 17) Goole api's has google play services. Check point 3 in the below link. So testing on emulator in the below versions will not work as it google maps need google play services.
http://developer.android.com/google/play-services/setup.html
I'm new here and also new in programming.
I'm making map, I have followed a lot of tutorials, all of them very simillar but I don't know why my app doesn't work. The app doesn't crash, but when I open the map appears the app title and a white screen where the map should appear. Do you know why is this happening?
Here are my app manifest, the activity:main.xml and the mainactivity.java, maybe here's the error that I can't find.
Also if helps logcat says me: Error opening trace file: No such file or directory (2)
APP MANIFEST
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tdr.mapa1"
android:versionCode="1"
android:versionName="1.0" >
<permission
android:name="com.tdr.mapa1.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="permission_name"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.tdr.mapa1.permission.MAPS_RECEIVE"/>
<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"/>
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="17" />
<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"
android:required="false"/>
<activity
android:name="com.tdr.mapa1.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>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</manifest>
MAIN ACTIVITY
<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"
tools:context=".MainActivity" >
</RelativeLayout>
MAINACTIVITY.JAVA
package com.tdr.mapa1;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
Hope you can help me.
See here,just change the api key with your key in manifest file and follow these steps:
and make sure that generate api key with package name which is mentioned in android manifest file and your google_play_services_lib project should be present in your project's work space only.
Manifest file:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<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" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.geeklabs.map.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="replace with your API key"/>
</application>
</manifest>
MainActivity.java:
package com.geeklabs.map;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
activity_main.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.MapFragment"/>
And make sure following steps done correct or not:
Steps:
* to ensure that device has Google Play services APK
* to install Google Play Service rev. more than 2
to create project at https://code.google.com/apis/console/
to enable "Google Maps Android API v2"
to register of SHA1 in project (NOW, YOU NEED WRITE SHA1;your.app.package.name) at APIs console and get API KEY
to copy directory ANDROID_SDK_DIR/extras/google/google_play_services/libproject/google-play-services_lib to root of your project
to add next line to the YOUR_PROJECT/project.properties
android.library.reference.1=google-play-services_lib
to add next lines to the YOUR_PROJECT/proguard-project.txt
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}
Okay, now you ready to create your own Google Map app with using Google Map APIs V2 for Android.
If you create application with min SDK = 8, please use android support library v4 + SupportMapFragment instead of MapFragment.
After got this let me know.
First your error:
Error opening trace file: No such file or directory (2)
doesn't mean anything and you should node pay any attention to it.
Second, both meta-data tags should be inside of the application scope, like so:
...
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="<API_KEY>"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
Lastly, you are not actually creating any map object in your activity layout file, what you have there is an empty RelativeLayout and hence the empty white screen. What you need is to add an MapFragment in there or SupportMapFramgnet depending on your target api. (In your case it would be MapFragment.)
Like so:
<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"
tools:context=".MainActivity" >
<fragment
android:name="com.google.android.gms.maps.MapFragment"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
You can get more detailed information from this blog post I wrote on this topic:
Google Maps API V2 Guide
All map related APIs are on. When I try to run on a real device a blank google map screen appears. In the code below I removed api key intentionally for posting.
MainActivity.java
package com.example.hellomap;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
public class MainActivity extends FragmentActivity {
private GoogleMap mMap;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setUpMapIfNeeded();
}
#Override
protected void onResume() {
super.onResume();
setUpMapIfNeeded();
}
private void setUpMapIfNeeded() {
if (mMap != null) {
return;
}
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
if (mMap == null) {
return;
}
// Initialize map options. For example:
// mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
}
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- TODO: Replace "com.example.hellomap" with your desired package name -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hellomap"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15"/>
<!-- TODO: Replace "com.example.hellomap" with your package name -->
<permission
android:name="com.example.hellomap.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.hellomap.permission.MAPS_RECEIVE"/>
<!-- The following four permissions -->
<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:label="#string/app_name"
android:icon="#drawable/ic_launcher">
<!-- TODO: Insert your Maps API key here. See this page for more information:
https://developers.google.com/maps/documentation/android/start#the_google_maps_api_key -->
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="Removed for posting"/>
<activity
android:name="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>
main.xml (Layout)
<?xml version="1.0" encoding="utf-8"?>
<!--
See this page for more XML attribute options
https://developers.google.com/maps/documentation/android/map#using_xml_attributes
-->
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.SupportMapFragment"
map:mapType="normal"/>
If you have updated you google-play-service library to revision 13, then you should add the following meta-data tag in your Manifest file:
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
And I suggest you recheck that you have turned on the Google Maps V2 API for Android in the API Console. Finally if all this doesn't work try to regenerate you SHA1 fingerprint and register it again in the console. Don't forget to delete your application completely from the device before testing a new API key as it is being cached.
Add this in your manifest file :
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Hope this helps.
In the device, if you run the exported apk file, then you will have to change the map api key according to keystore name(keystore file is created when you export the app).
After doing this, the map will be displayed on the device.
See here,just change the api key with your key in manifest file and follow these steps:
and make sure that generate api key with package name which is mentioned in android manifest file and your google_play_services_lib project should be present in your project's work space only.
Manifest file:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<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" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.geeklabs.map.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="replace with your API key"/>
</application>
</manifest>
MainActivity.java:
package com.geeklabs.map;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
activity_main.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.MapFragment"/>
I had a working Google maps API v2 for Android example application that worked perfectly until I initialized a git repository in it's directory.
I have since then erased the entire project, all references to it in the Google cloud control, and started a new project.
The problem I'm facing now is an authentication issue:
11-07 10:44:05.445: E/Google Maps Android API(3640): Ensure that the following correspond to what is in the API Console: Package Name: [package name], API Key: [key], Certificate Fingerprint: [fingerprint]
I already tried with no avail:
1. Triple check API key and correct
2. Erase the entire project, disable Google maps API v2 for Android, enable it again and recreate the project
3. Add permissions for MAPS_RECEIVE
4. Cleaning, removing, and re-installing the release package
Really stumped by this one...
Here is the manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mycompany.mypackage"
android:versionCode="1"
android:versionName="1.0" >
<permission
android:name="com.mycompany.mypackage.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="com.mycompany.mypackage.permission.MAPS_RECEIVE" />
<!--
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" />
<uses-sdk
android:minSdkVersion="13"
android:targetSdkVersion="18" />
<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="[My Key]" />
<activity
android:name="com.mycompany.canipark.MapExample"
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>
And here is the code:
package com.mycompany.mypackage;
import com.mycompany.mypackage.R;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class MapExample extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gmaps);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.gmaps, menu);
return true;
}
}
And the layout:
<?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/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
map:mapType="normal" />
And the Google cloud console:
http://i.stack.imgur.com/hSx9N.jpg
http://i.stack.imgur.com/8sNbm.jpg
ID of your package is com.mycompany.canipark, but in console com.mycompany
Also, try to write
<uses-library android:name="com.google.android.maps"/>
In AndroidManifest.xml in <application> section
I really don't understand this..
I waited two days, and suddenly everything's working again. I didn't change a single line of code.
Wish Google will add a meaningful error other than Authorization failure when it does...
Thanks guys for your help!
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