I followed steps in the developers guide in programming google maps. My API keys are fine. I also installed apks so that i can run the map application to the emulator.
As i run my android emulator, an error "Unfortunately Google Play Services has stopped" pops up. But the thing is the map works fine after you just click OK.
I just copied all the codes from the beginners guide provided so no need to copy my code here. Anyone knows the problem? thanks
UPDATE I think I've found a possible solution: instead of using the Google Play Services apk from my rooted device, I used the apks included in this link: Google Play Services 4.1 and I haven't seen those crashes anymore.
OLD PROBLEM Same thing here... I've seen this in my logs:
01-27 09:49:11.164 2068-2075/com.google.android.gms E/jdwp﹕ Failed sending reply to debugger: Broken pipe
01-27 09:49:12.554 2068-2068/com.google.android.gms E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1130)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2558)
at android.app.ActivityThread.access$1600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1338)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.SecurityException: attempting to read gservices without permission: Neither user 10042 nor current process has com.google.android.providers.gsf.permission.READ_GSERVICES.
at android.app.ContextImpl.enforce(ContextImpl.java:1575)
at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:1604)
at android.content.ContextWrapper.enforceCallingOrSelfPermission(ContextWrapper.java:551)
at ghj.c(SourceFile:107)
at ghj.a(SourceFile:121)
at ghj.a(SourceFile:216)
at awe.a(SourceFile:218)
at avz.a(SourceFile:135)
at avx.b(SourceFile:104)
at com.google.android.gms.init.InitializeIntentService.<clinit>(SourceFile:48)
at java.lang.Class.newInstanceImpl(Native Method)
...
However, that permission mentioned in the logs is included in the manifest correctly.
What I did was to extract the Google Play Services apk from a rooted deviced, and installed it in my x86 emulator via adb.
Any help?
Thanks!
来源:https://stackoverflow.com/questions/21239221/unfortunately-google-play-services-has-stopped-but-map-works-fine