This app won't run unless you update Google Play Services (via Bazaar)
Asked Answered
F

12

102

I'm testing out the new Google Maps API V2 for Android, and I'm getting this message when the app launches:

MainActivity showing error message

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:

https://mcmap.net/q/41663/-how-to-download-google-play-services-in-an-android-emulator

Fundamentalism answered 3/12, 2012 at 21:22 Comment(14)
Are you using avd with google api or plain android?Irkutsk
Plain Android, although I just tried switching to the Google API's for 4.1 and it's the same.Fundamentalism
Strangely enough I'm looking at exactly the same problem at exactly the same time. I'm assuming so far that it's because the Google Play Services APK isn't installed on the Emulator. The error is because the app is trying to launch Google Play (the store) to install the APK. It'll probably work fine on a device.Milly
Yes it looks that way doesn't it? The Google Services setup docs say nothing about installing the Play application though: developer.android.com/google/play-services/setup.htmlFundamentalism
The lack of other references to this problem suggests to me that it's quite a recent bug. I can't help but think I've missed something in the setup but I've been through it a few times now. This would literally take 5 mins to set up on iOS - quite annoying :-(Milly
@Milly yes you are right iOS 6 maps are awesome!Hulburt
How about the included sample, MapDemo, does that work for you? Mine crashes on the same emulator with a ExceptionInInitializationErrorFundamentalism
I've not tried that yet. My next step would probably be to try it on a device but unfortunately my wife's taken my nexus 7 to work. I've got plenty of devices at work so I'm going to try it tomorrow in the office. I'll let you know on here if it works fine. There are other posts with people having trouble on device when it works on emulator though (due to device keys). #8683080Milly
googlegeodevelopers.blogspot.com - suggests that a new version came out today. Great release Google :-)Milly
Raised - code.google.com/p/gmaps-api-issues/issues/detail?id=4627Milly
Well I'm using that new API, I thought you were too?Fundamentalism
Yes, using the new one. I'd move back to the old one but doesn't look possible?Milly
@Fundamentalism How to set up a fast emulator for Android on Linux?Daimon
check this updated answerEscapade
A
42

According to a discussion with Android Developers on Google+, running the new Map API on the emulator is not possible at the moment.

(The comment is from Zhelyazko Atanasov yesterday at 23:18, I don't know how to link directly to it)

Also, you don't see the "(via Bazaar)" part when running from an actual device, and the update button open the Play Store. I am assuming Bazaar is meant to provide Google Play Services on the Android emulator, but it is not ready yet...

Actinotherapy answered 4/12, 2012 at 10:25 Comment(1)
I tried copying the latest GmsCore.apk directly to the emulator but that's not working either. It probably would work if I knew exactly which APKs to copy from my rooted device.Matteroffact
R
56

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:

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:

adb install com.android.vending-20140218.apk
adb install com.google.android.gms-20140218.apk

If you are upgrading an existing emulator then you might need to uninstall previous versions by:

adb uninstall com.android.vending
adb uninstall com.google.android.gms

That's all.

Rational answered 3/12, 2012 at 21:23 Comment(12)
Doesn't matter if your emulator is x86 or ARM. Platform: 4.2 is fine also.Elector
According to developer.android.com/google/play-services/index.html. Deveices with Android 2.2 (that is API level 8) should be sufficient as long as the devices also has GL ES version 2.Zoomorphism
I tried installing those files but adb showed me failure message that the files were already installed. I tried reinstalling, then it said the certificates are inconsistent. What should I do then?Abloom
I was able to uninstall pre-installed packages with adb uninstall com.android.vending and adb uninstall com.google.android.gms. After installing above mentioned packages my application runs but I see EGL_emulation: eglSurfaceAttrib not implemented warning messages in the log and no map is visible in the application. This is, I believe, emulator/GPU issue. My GPU is Radeon HD6870 and I was running Android 4.1.2 without Google APIs on the emulator.Cardoza
Regarding the "EGL_emulation: eglSurfaceAttrib not implemented" perhaps try "Use Host GPU" under the emulation options.Elector
If the map appears but has no visible tiles, double-check your api key is set correctly in the android manifest.Elector
@Martynas I also have "EGL_emulation: eglSurfaceAttrib not implemented" and the map still works.Elector
@strawberryjam You are installing the files on a freshly constructed emulator ?Elector
@strawberryjam Check your emulator was constructed with the plain "Android 4.2" (or whatever version) rather than the "Google Apis - Api Level 17" option.Elector
I found that the google ARM image API:19 Revision:3 just works with maps-v2. But the x86 one doesn't .. weird.Elector
Please check https://mcmap.net/q/41665/-android-wear-emulator-show-error-service_version_update_required-for-google-play-services/968532 , Have you any idea about that ?Friendly
@DanBrough where did you get the files? They are obviously getting outdated, why wouldn't just post url to the source of the most recent updates?Hugo
A
42

According to a discussion with Android Developers on Google+, running the new Map API on the emulator is not possible at the moment.

(The comment is from Zhelyazko Atanasov yesterday at 23:18, I don't know how to link directly to it)

Also, you don't see the "(via Bazaar)" part when running from an actual device, and the update button open the Play Store. I am assuming Bazaar is meant to provide Google Play Services on the Android emulator, but it is not ready yet...

Actinotherapy answered 4/12, 2012 at 10:25 Comment(1)
I tried copying the latest GmsCore.apk directly to the emulator but that's not working either. It probably would work if I knew exactly which APKs to copy from my rooted device.Matteroffact
B
39

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:

  1. Create a new emulator with the following configuration:

Enter image description here

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:

  • GoogleLoginService.apk
  • GoogleServicesFramework.apk
  • Phonesky.apk

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:

Google Maps

Blip answered 7/12, 2012 at 14:32 Comment(5)
I think this method has some unnececery steps. Try my method from one of the other answer with only two apks to install...Madriene
I tried your method, but at load applications to system/app dir adb generated an error saying that it is not enough free space. Creating a new emulator with a large amount of memory did not help. On other versions of the emulator your method did not work.Blip
In step 3) the install command is adb install com.google.android.apps.maps-1.apk and adb install com.google.android.gms-2.apk.Privateer
And make sure you get a version of google play service that fits your needs. You can download them from papktop.com/tag/google-play-services-apk.Privateer
Just make sure you are always installing the latest Google Play APK version, because at the current moment, Google Play v2, won't let you install update (giving the nasty 491 error) and this update is required to run Google Maps applications.Handball
M
29

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

  • For device, choose "5.1'' WVGA (480 x 800: mdpi)"
  • For target, choose "Android 4.1.2 - API level 16"
  • For "CPU/ABI", choose "ARM"
  • Leave the rest to defaults

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.

Madriene answered 6/12, 2012 at 0:19 Comment(4)
Here is the link to my blog with the description of what I've tried to make this work nemanjakovacevic.net/blog/2012/12/…Madriene
Unfortunately google play services revision 4 gives new error: Google Play services out of date. Requires 2012100 but found 2010110Hogg
Ok, if you have play services 4th revision, look at the @Rational answer, and download apks specified in the comment: linkHogg
note that this works with x86 too, making the emulator much more snappy!Superiority
I
3

I've created a (German) description how to get it working. You basically need an emulator with at least API level 9 and no Google APIs. Then you'll have to get the APKs from a rooted device:

adb -d pull /data/app/com.android.vending-2.apk
adb -d pull /data/app/com.google.android.gms-2.apk

and install them in the emulator:

adb -e install com.android.vending-2.apk
adb -e install com.google.android.gms-2.apk

You can even run the native Google Maps App, if you have an emulator with at least API level 14 and additionally install com.google.android.apps.maps-1.apk

Have fun.

Indium answered 8/5, 2013 at 5:49 Comment(0)
O
2

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.

Octans answered 11/3, 2013 at 12:32 Comment(1)
those are the files to install: vending.apk and gms.apkOctans
C
2

This app won't run unless you update Google Play Services. I have tried it for such a long much time, but still I didn't get the map... Only a blank screen is appearing, even if I modified my Google Play Service given by the below comment..


Check your play services manifest file and check the version code for the APK file com.google.android.gms. In the below, it is "3136110". Download these APK files and install from a DOS prompt, but before installation run your target emulator.

package="com.google.android.gms"
android:versionCode="3136110"
android:versionName="3.1.36 (673201-10)

I got these APK files from this link.

Clarino answered 23/8, 2013 at 13:18 Comment(0)
D
2

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.

    enter image description here

  • 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:

    enter image description here

Danita answered 30/5, 2014 at 13:34 Comment(1)
@Daimon I am edited check it out.It will work.Thanks for pointed it.Danita
P
0

After updating to ADT 22.0.1, due to Android private libraries, the Google Maps service was giving some error and the app crashed. So I found the solution finally and it worked for me.

Just install the Google Play service library and then go to google-play-service/libproject/google-play-services_lib from https://www.dropbox.com/sh/2ok76ep7lmav0qf/9XVlv61D2b. Import that into your workspace. Clean your project where you want to use gogole-play-services-lib and then build it again and go to the Project -> Properties -> Java BuildPath -> select "Android Private Libraries, Android Dependencies, google-play-service"

In Properties itself, go to Android and then choose any of the versions and then choose add and select google-play-service-lib and then press apply and finally OK.

At last, go to the Project -> Android Tools -> Android Support Libraries. Accept the license and after installing then run your project.

It will work fine.

Priestcraft answered 3/6, 2013 at 7:6 Comment(0)
C
0

I have found a nice solution which let you test your app in the emulator and also doesn't require you to revert to the older version of the library. See an answer to Stack Overflow question Running Google Maps v2 on the Android emulator.

Courtland answered 11/6, 2013 at 4:11 Comment(0)
K
0

From Android SDK Manager, install: Extras: Google Play services

Kienan answered 21/11, 2015 at 14:48 Comment(0)
G
0
 just change it to 

compile 'com.google.android.gms:play-services-maps:9.6.0'
compile 'com.google.android.gms:play-services-location:9.6.0'

this works for me current version is 10.0.1

Giffie answered 3/12, 2016 at 11:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.