Phil Andrews
Phil Andrews

Reputation: 409

NoClassDefFoundError Due to Google Maps v2

I have recently had to update my SDK and ADT and since then I have been having loads of trouble with existing applications. My problem is that with one of my applications I am getting the following error:

05-24 09:13:49.234: E/AndroidRuntime(7064): FATAL EXCEPTION: main
05-24 09:13:49.234: E/AndroidRuntime(7064): java.lang.NoClassDefFoundError: com.taxi.cabfind.Map_Location
05-24 09:13:49.234: E/AndroidRuntime(7064):     at com.taxi.cabfind.Pickup_Address$5.onClick(Pickup_Address.java:239)
05-24 09:13:49.234: E/AndroidRuntime(7064):     at android.view.View.performClick(View.java:4204)
05-24 09:13:49.234: E/AndroidRuntime(7064):     at android.view.View$PerformClick.run(View.java:17355)
05-24 09:13:49.234: E/AndroidRuntime(7064):     at android.os.Handler.handleCallback(Handler.java:725)
05-24 09:13:49.234: E/AndroidRuntime(7064):     at android.os.Handler.dispatchMessage(Handler.java:92)
05-24 09:13:49.234: E/AndroidRuntime(7064):     at android.os.Looper.loop(Looper.java:137)
05-24 09:13:49.234: E/AndroidRuntime(7064):     at android.app.ActivityThread.main(ActivityThread.java:5041)
05-24 09:13:49.234: E/AndroidRuntime(7064):     at java.lang.reflect.Method.invokeNative(Native Method)
05-24 09:13:49.234: E/AndroidRuntime(7064):     at java.lang.reflect.Method.invoke(Method.java:511)
05-24 09:13:49.234: E/AndroidRuntime(7064):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
05-24 09:13:49.234: E/AndroidRuntime(7064):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
05-24 09:13:49.234: E/AndroidRuntime(7064):     at dalvik.system.NativeStart.main(Native Method)

This is occurring when I am trying to load up a fragment activity that contains maps v2.

This is confusing to me because in another application that I have, there is maps v2 code inside this app and this app has no problems with it. I have checked all the settings and made sure that everything matches, but I am still getting this crash.

Can someone please help.

EDIT

In changing the project and placing the google-play-services-lib.jar file in the libs folder I am now getting the following error

05-24 09:35:27.169: E/AndroidRuntime(11672): FATAL EXCEPTION: main
05-24 09:35:27.169: E/AndroidRuntime(11672): java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
05-24 09:35:27.169: E/AndroidRuntime(11672):    at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:279)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at android.app.Activity.setContentView(Activity.java:1881)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at com.taxi.cabfind.Map_Location.onCreate(Map_Location.java:81)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at android.app.Activity.performCreate(Activity.java:5104)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at android.app.ActivityThread.access$600(ActivityThread.java:141)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at android.os.Handler.dispatchMessage(Handler.java:99)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at android.os.Looper.loop(Looper.java:137)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at android.app.ActivityThread.main(ActivityThread.java:5041)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at java.lang.reflect.Method.invokeNative(Native Method)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at java.lang.reflect.Method.invoke(Method.java:511)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
05-24 09:35:27.169: E/AndroidRuntime(11672):    at dalvik.system.NativeStart.main(Native Method)

This is now exactly the same as my other project that is working, I am really confused at why this one isn't working

Upvotes: 0

Views: 720

Answers (2)

Chen Wei Li
Chen Wei Li

Reputation: 77

I upgrate SDK and ADT(ver22) yesterday just like you . And have same error I try this and it's work ...

enter image description here

Upvotes: 1

Raghunandan
Raghunandan

Reputation: 133560

You should not place the jar in libs folder.

You should google play services library project in your android project.

Import library project into workspace and eclipse.

Right click on your android project. goto properties. Choose android. click add. Browse the library project and add the same.

Now if you have updated adt to rev 22.

java.lang.ClassNotFoundException after changing nothing in the project but upgrading eclipse android sdk

to check if its a library project. right click on your google play services library goto properties choose android. You will see Is Library check box checked

After adding it looks similar to the one below enter image description here

Upvotes: 1

Related Questions