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!
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
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.
I have been developing a simple app for load a map view. I have followed the API. https://developers.google.com/maps/documentation/android/start#add_a_map
BUT
after the execution app goes force close and a LOGCAT ERROR
The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4030500 but found 0.
this is my manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.newgmaps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="13" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyA5QozHkGwJP_9iJi7jtBV938T1wws02gA" />
<activity
android:name="com.example.newgmaps.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.gms.version" android:value="#integer/google_play_services_version" />
</application>
this is my 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 this is main activity
package com.example.newgmaps;
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);
}
#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;
}
}
Do these 2 steps and let me know please
1st update your Google play services as show here
2nd try out this new manifest file that i have created for you
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.newgmaps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="11" />
<permission
android:name="com.example.newgmaps.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="icom.example.newgmaps.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<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" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="4030500" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyA5QozHkGwJP_9iJi7jtBV938T1wws02gA" />
<activity
android:name="com.example.newgmaps.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>
let me know if you solved this problem also
Thank you
Use the previous version of Google Play Services libproject for now. It can be downloaded from here: https://dl-ssl.google.com/android/repository/google_play_services_3225130_r10.zip
Worked for me.
You can then update this later when Google makes the latest version available to everyone but something tells me it will be a while before this change propagates to all the devices out there.
I have the same problem when running the app on my 2012 N7 running 4.3.
I don't think the actual released version of Play Services matches the SDK version in version.xml:
google_play_services_version 4030500
So it's either a case of waiting for a Play Services update on Play Store, or possibly try changing the version.xml in google-play-services_lib.
If you start the Android SDK manager you should see a "Google play services for Froyo" module. Install and use this instead of the "new" version. This worked for me.
Google must update Google play services to version 4.xxx
I added this below xml code in "AndroidManifest.xml"
<Application
...
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
...
</Application>
The crash error was disappeared.
But when I call...
int iErrorCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
"iErrorCode" is 2. 2 means like this
public static final int SERVICE_VERSION_UPDATE_REQUIRED
The installed version of Google Play services is out of date. The calling activity should pass this error code to getErrorDialog(int, Activity, int) to get a localized error dialog that will resolve the error when shown.
Constant Value: 2 (0x00000002)
Details...
And also LogCat said...
W/GooglePlayServicesUtil(4728): Google Play services out of date. Requires 4030500 but found 3266136
Where is version code "4030500"??
[SDK]\extras\google\google_play_services\libproject\google-play-services_lib\res\values
You can see "version.xml". Open it!
<?xml version="1.0" encoding="utf-8"?> <resources>
<integer name="google_play_services_version">4030500</integer>
</resources>
Peekaboo~~! :)
This is why we got this errorCode(2) when update new SDK and use new "google-play-services-lib".
Okay! Got it! Let's check my Google Play Version on my device.
The version on my phone is "4.4.21" There is no problem I think.
What is this "3266136"? Where were this from? I cannot understand this.
If I figure this out, I will update this long answer.
Good luck! Everybody! :)
Updated 1:
I downloaded apk 4.4.22 and installed on my phone. But, LogCat still show me "3266136".
This is really odd thing. I think Google-Team have to fix it ASAP!!
4.4.22 Download here...
Updated 2:
After all, I decided to down-grade "google-play-services_lib" and "android-support-v4.jar" to previous version. I will be wait for them. :)
try to add this meta-data tag in the application tag in the Manifest :
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
I want to add google map in my android app. After following all the steps and removing exceptions such as "inflating class fragment", my AVD is now showing This app won't work unless you update Google play services. I tried to update Google play services through the following steps
Right click on Project > Android Tools > Add Support Library
But got 2 error messages.
[2013-08-08 09:36:00 - SDK Manager] Failed to fetch URL https://dl-ssl.google.com/android/repository/addons_list-2.xml, reason: Connection to http://10.10.10.100:8080 refused
[2013-08-08 09:37:45 - SDK Manager] Failed to fetch URL https://dl-ssl.google.com/android/repository/repository-8.xml, reason: HttpHostConnect Connection to http://10.10.10.100:8080 refused
I am using the emulator Eclipse version 4.2.0
manifest.xml file is attached here
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.newapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<permission
android:name="com.example.newapp.maps.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.newapp.maps.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.newapp.NewApp"
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="*********************************" />
</application>
</manifest>
activity_new_app.xml
<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=".NewApp" >
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout
>
NewApp.java
package com.example.newapp;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
public class NewApp extends FragmentActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new_app);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.new_app, menu);
return true;
}
}
Please give me any suggestion.
Google Android Map Api v2 doc says,you can't run google maps v2 on Android emulator. You must use a device for your tests. But some people suggest it can be done by installing the required services like Google Play Services in the emulator. See the various answers of the following post, you will get some clue.
Running Google Maps v2 on the Android emulator