0

So I found a tutorial here . but I can't run it even on a real device. I found similar problems here and 20 other pages and all people have had my problem but I can't figure out why Google maps doesn't work on android. Here is the error in Logcat.

03-09 23:06:22.050: D/dalvikvm(28176): Late-enabling CheckJNI
03-09 23:06:22.277: W/dalvikvm(28176): VFY: unable to resolve static field 874 (MapAttrs) in Lcom/google/android/gms/R$styleable;
03-09 23:06:22.277: D/dalvikvm(28176): VFY: replacing opcode 0x62 at 0x000e
03-09 23:06:22.285: D/AndroidRuntime(28176): Shutting down VM
03-09 23:06:22.285: W/dalvikvm(28176): threadid=1: thread exiting with uncaught exception (group=0x40bbe1f8)
03-09 23:06:22.285: E/AndroidRuntime(28176): FATAL EXCEPTION: main
03-09 23:06:22.285: E/AndroidRuntime(28176): java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
03-09 23:06:22.285: E/AndroidRuntime(28176):    at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at android.app.Activity.onCreateView(Activity.java:4242)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:673)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:273)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at android.app.Activity.setContentView(Activity.java:1835)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at com.alirezasaremi.showmap.ShowMapActivity.onCreate(ShowMapActivity.java:23)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at android.app.Activity.performCreate(Activity.java:4465)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at android.app.ActivityThread.access$600(ActivityThread.java:128)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at android.os.Handler.dispatchMessage(Handler.java:99)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at android.os.Looper.loop(Looper.java:137)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at android.app.ActivityThread.main(ActivityThread.java:4514)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at java.lang.reflect.Method.invokeNative(Native Method)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at java.lang.reflect.Method.invoke(Method.java:511)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
03-09 23:06:22.285: E/AndroidRuntime(28176):    at dalvik.system.NativeStart.main(Native Method)

Could someone help me please?

Community
  • 1
  • 1
IndieBoy
  • 1,102
  • 3
  • 14
  • 25

2 Answers2

0

I know this error: java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable

You should import google play services lib project into workspace, not just add external jar to project. Here is detailed info:

Android developers topic related "Copy the /extras/google/google_play_services/libproject/google-play-services_lib library project into the source tree where you maintain your Android app projects. If you are using Eclipse, import the library project into your workspace. Click File > Import, select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it."

Rodion Altshuler
  • 1,713
  • 1
  • 15
  • 31
0

Here is a blog post I wrote on how to add a Google Map API V2 to your application. please follow closely the first 4 step in order to add the google-play-services project to your work-space and then to create a reference to it from your project:

Creating Google Map API V2

Emil Adz
  • 40,709
  • 36
  • 140
  • 187