Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
338 views
in Technique[技术] by (71.8m points)

android - Google map API v2 is not working

I am trying to run sample code mention here : Google Maps Android API V2 Sample code

but i am getting error NoClassDefFound. Below is my logcat.

Can any one help me to solve it. Any help is highly appricated Thanks

12-04 18:04:18.854: E/AndroidRuntime(1801): java.lang.ExceptionInInitializerError
12-04 18:04:18.854: E/AndroidRuntime(1801):     at java.lang.Class.newInstanceImpl(Native Method)
12-04 18:04:18.854: E/AndroidRuntime(1801):     at java.lang.Class.newInstance(Class.java:1319)
12-04 18:04:18.854: E/AndroidRuntime(1801):     at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
12-04 18:04:18.854: E/AndroidRuntime(1801):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
12-04 18:04:18.854: E/AndroidRuntime(1801):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
12-04 18:04:18.854: E/AndroidRuntime(1801):     at android.app.ActivityThread.access$600(ActivityThread.java:130)
12-04 18:04:18.854: E/AndroidRuntime(1801):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
12-04 18:04:18.854: E/AndroidRuntime(1801):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-04 18:04:18.854: E/AndroidRuntime(1801):     at android.os.Looper.loop(Looper.java:137)
12-04 18:04:18.854: E/AndroidRuntime(1801):     at android.app.ActivityThread.main(ActivityThread.java:4745)
12-04 18:04:18.854: E/AndroidRuntime(1801):     at java.lang.reflect.Method.invokeNative(Native Method)
12-04 18:04:18.854: E/AndroidRuntime(1801):     at java.lang.reflect.Method.invoke(Method.java:511)
12-04 18:04:18.854: E/AndroidRuntime(1801):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
12-04 18:04:18.854: E/AndroidRuntime(1801):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
12-04 18:04:18.854: E/AndroidRuntime(1801):     at dalvik.system.NativeStart.main(Native Method)
12-04 18:04:18.854: E/AndroidRuntime(1801): Caused by: java.lang.NoClassDefFoundError: com.example.mapdemo.BasicMapActivity
12-04 18:04:18.854: E/AndroidRuntime(1801):     at com.example.mapdemo.MainActivity.<clinit>(MainActivity.java:98)
12-04 18:04:18.854: E/AndroidRuntime(1801):     ... 15 more
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I had the same problem and got resolved by doing the following,

  • Remove the android-support-v4.jar that you added manually
  • Right click on the project and select Android Tools -> Add Support Library ...

After this everything worked for me.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...