I'm testing out the new Google Maps API V2 for Android, and I'm getting this message when the app launches:
This is running on an 4.1 emulator.
Here is my AndroidManifest.xml
file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.maptest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<permission
android:name="com.example.maptest.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.maptest.permission.MAPS_RECEIVE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.INTERNET"/>
<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"/>
<!-- Require OpenGL ES version 2 -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
<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="##myapikey##"/>
</application>
</manifest>
File MainActivity.java:
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
File activity_main.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" >
<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"/>
</RelativeLayout>
Clicking "Update" crashes the app with the following stacktrace:
E/Trace(1034): error opening trace file: No such file or directory (2)
W/GooglePlayServicesUtil(1034): Google Play services out of date. Requires 2010100 but found 1
W/GooglePlayServicesUtil(1034): Google Play services out of date. Requires 2010100 but found 1
W/GooglePlayServicesUtil(1034): Google Play services out of date. Requires 2010100 but found 1
W/GooglePlayServicesUtil(1034): Google Play services out of date. Requires 2010100 but found 1
W/GooglePlayServicesUtil(1034): Google Play services out of date. Requires 2010100 but found 1
W/GooglePlayServicesUtil(1034): Google Play services out of date. Requires 2010100 but found 1
D/gralloc_goldfish(1034): Emulator without GPU emulation detected.
D/AndroidRuntime(1034): Shutting down VM
W/dalvikvm(1034): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
E/AndroidRuntime(1034): FATAL EXCEPTION: main
E/AndroidRuntime(1034): android.content.ActivityNotFoundException: No Activity found to handle Intent
{ act=android.intent.action.VIEW dat=http://play.google.com/store/apps/details? \
id=com.google.android.apps.bazaar flg=0x80000 pkg=com.android.vending }
E/AndroidRuntime(1034): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1545)
E/AndroidRuntime(1034): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1416)
E/AndroidRuntime(1034): at android.app.Activity.startActivityForResult(Activity.java:3351)
E/AndroidRuntime(1034): at android.app.Activity.startActivityForResult(Activity.java:3312)
E/AndroidRuntime(1034): at android.app.Activity.startActivity(Activity.java:3522)
E/AndroidRuntime(1034): at android.app.Activity.startActivity(Activity.java:3490)
E/AndroidRuntime(1034): at com.google.android.gms.internal.c$2.onClick(Unknown Source)
E/AndroidRuntime(1034): at android.view.View.performClick(View.java:4084)
E/AndroidRuntime(1034): at android.view.View$PerformClick.run(View.java:16966)
E/AndroidRuntime(1034): at android.os.Handler.handleCallback(Handler.java:615)
E/AndroidRuntime(1034): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime(1034): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(1034): at android.app.ActivityThread.main(ActivityThread.java:4745)
E/AndroidRuntime(1034): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(1034): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(1034): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime(1034): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime(1034): at dalvik.system.NativeStart.main(Native Method)
I've also referenced the Google Play Services project. What am I doing wrong here?
UPDATE
The corresponding bug in Google issue tracker (https://issuetracker.google.com/issues/35822258) was solved some time ago.
Now you can use Google Maps Android API in emulator and create Virtual devices with Play services as described in this answer:
I'm answering this question for the second time, because the solution I've tried that didn't work at first now works, and I can recreate the steps to make it work :)
I also had a feeling that lack of Google Play Store is a culprit here, so I've tried to install Google Play Store to the emulator by advice on this link and this link combined. I've had some difficulties, but at the end I've succeeded in installing Google Play Store and tested it by downloading some random app. But the maps activity kept displaying the message with the "Update" button. That button would take me to the store, but there I would get a message about "item not found" and maps still didn't work. At that point I gave up.
Yesterday, I've fired up the same test app by accident and it worked! I was very confused, but quickly I've made a diff from the emulator where it's working and new clean one and I've determined two apps on the working one in /data/app/ directory: com.android.vending-1.apk and com.google.android.gms-1.apk. This is strange since, when I were installing Google Play Store by instructions from those sites, I was pushing Phonesky.apk, GoogleServicesFramework.apk and GoogleLoginService.apk and to a different folder /system/app.
Anyway, now the Android Google Maps API v2 is working on my emulator. These are the steps to do this:
Create a new emulator
These are the settings that are working for me. I don't know for different ones.
Start the emulator
install com.android.vending-1.apk and com.google.android.gms-1.apk via ADB install command
Google Maps should work now in your emulator.
UPDATE
The Google maps API v2 is now installed on the latest Google system images (api:19 ARM or x86).
So your application should just work with the new images. There is no need to install these files.
I've been trying to run an Android Google Maps V2 application under an emulator and once I finally got Google Play Services running, I updated my SDK to Google Play Services revision 4, and my emulator wouldn't run my application any more.
I have now worked out how to update my emulator from my transformer tablet. (You won't need a tablet as you can download the files below.)
I used Titanium Backup to backup my Asus Eee Pad Transformer (TF101) and then grabbed the com.android.vending and the com.google.android.gms APK files from the backup.
I installed these on an emulator configured with platform: 4.1.2, API Level: 16, CPU Intel/Atom x86) and my Google Maps V2 application works again.
That was all .. none of the other steps regarding /system/app were required.
My application only uses the Google Maps API, no doubt, more steps are required if you use other Google Play services.
New files for latest Google Play services:
com.google.android.gms-20140218.apk
com.android.vending-20140218.apk
Same instructions as before: Create a new emulator with any CPU/ABI, a non-Google API target (versions 10-19 work) and GPU emulation on or off, and then install the files:
If you are upgrading an existing emulator then you might need to uninstall previous versions by:
That's all.
I've been trying to run an Android Google Maps v2 under an emulator, and I found many ways to do that, but none of them worked for me. I have always this warning in the Logcat
Google Play services out of date. Requires 3025100 but found 2010110
and when I want to update Google Play services on the emulator nothing happened. The problem was that the com.google.android.gms APK was not compatible with the version of the library in my Android SDK.I installed these files "com.google.android.gms.apk", "com.android.vending.apk" on my emulator and my app Google Maps v2 worked fine. None of the other steps regarding /system/app were required.
From Android SDK Manager, install: Extras: Google Play services
I spent about one day to configure the new gmaps API (Google Maps Android API v2) on the Android emulator. None of the methods of those I found on the Internet was working correctly for me. But still I did it. Here is how:
On the other versions I could not configure because of various errors when I installed the necessary applications.
2) Start the emulator and install the following applications:
You can do this with following commands:
2.1)
adb shell mount -o remount,rw -t yaffs2 /dev/block/mtdblock0 /system
2.2)
adb shell chmod 777 /system/app
2.3-2.5)
adb push Each_of_the_3_apk_files.apk /system/app/
Links to download APK files. I have copied them from my rooted Android device.
3) Install Google Play Services and Google Maps on the emulator. I have an error 491, if I install them from Google Play store. I uploaded the apps to the emulator and run the installation locally. (You can use
adb
to install this). Links to the apps:4) I successfully run a demo sample on the emulator after these steps. Here is a screenshot:
I solved these problem by doing the following steps:
In Emulator:
You have to use the latest API
Google APIs(Google Inc.)-API Level 19
.Do the rest of the things placed in the screenshot itself.
API Key:
Create New API Key and Check carefully about Google Map API key and SHA Key.
Google Play Services:
You have to download the latest Google Play Services com.android.vending-4.8.20.apk.In that site if google play services wasn't working means you can find a lot of sites in internet named
com.android.vending 4.8.20.apk
.you can run the Google play Services by using the Command Prompt
adb install com.android.vending 4.8.20.apk
.Note: You have to download the latest Google play services because year by year latest version will be updated in internet.
output: