Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable

Hi all I am getting a exception while working with support lib. I know lot of question and answer are available in SO but no one work for me

11-27 11:58:15.470: E/AndroidRuntime(19609): FATAL EXCEPTION: main
11-27 11:58:15.470: E/AndroidRuntime(19609): java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable
11-27 11:58:15.470: E/AndroidRuntime(19609):    at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:147)
11-27 11:58:15.470: E/AndroidRuntime(19609):    at android.support.v7.app.ActionBarActivityDelegateBase.onCreate(ActionBarActivityDelegateBase.java:138)
11-27 11:58:15.470: E/AndroidRuntime(19609):    at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:123)
11-27 11:58:15.470: E/AndroidRuntime(19609):    at com.devicemonitor.DeviceMonitorActivity.onCreate(DeviceMonitorActivity.java:29)
11-27 11:58:15.470: E/AndroidRuntime(19609):    at android.app.Activity.performCreate(Activity.java:5104)
11-27 11:58:15.470: E/AndroidRuntime(19609):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
11-27 11:58:15.470: E/AndroidRuntime(19609):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
11-27 11:58:15.470: E/AndroidRuntime(19609):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
11-27 11:58:15.470: E/AndroidRuntime(19609):    at android.app.ActivityThread.access$600(ActivityThread.java:141)
11-27 11:58:15.470: E/AndroidRuntime(19609):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
11-27 11:58:15.470: E/AndroidRuntime(19609):    at android.os.Handler.dispatchMessage(Handler.java:99)
11-27 11:58:15.470: E/AndroidRuntime(19609):    at android.os.Looper.loop(Looper.java:137)
11-27 11:58:15.470: E/AndroidRuntime(19609):    at android.app.ActivityThread.main(ActivityThread.java:5041)
11-27 11:58:15.470: E/AndroidRuntime(19609):    at java.lang.reflect.Method.invokeNative(Native Method)
11-27 11:58:15.470: E/AndroidRuntime(19609):    at java.lang.reflect.Method.invoke(Method.java:511)
11-27 11:58:15.470: E/AndroidRuntime(19609):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
11-27 11:58:15.470: E/AndroidRuntime(19609):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
11-27 11:58:15.470: E/AndroidRuntime(19609):    at dalvik.system.NativeStart.main(Native Method)

What i have did is like this - I have android-support-v7-appcompat.jar as well as android-support-v4.jar in android java build path.

In some answer in SO suggested that unchecked Android dependencies in java build path i tried it also but nothing is working for me.

In my gen folder there are two package one for goole-play-service-lib and another for my project , and in my project package under gen folder only trwo file is there R.java and BuildCOnfig.java. Anybody have any suggestion please suggest me

like image 476
Dilshad Ahmad Avatar asked Nov 27 '14 06:11

Dilshad Ahmad


3 Answers

Import the support.v7.appcompat as a library project in your workspace and attach it with your project.

Try this,it will work for sure. if you still face any issue, do comment.

like image 120
Nitesh Avatar answered Oct 20 '22 05:10

Nitesh


You have to just delete your appcompat and re-import it to eclipse and change its android built property to highest api configuration. Clean your project, copy-paste R file in gen package and change project build path to highest api level like api-21.

This will solve your problem.

like image 35
Sanwal Singh Avatar answered Oct 20 '22 04:10

Sanwal Singh


In "android-support-v7-appcompat" project:

-Delete “android-support-v7-appcompat” from Package explorer.
-Import again and check “Copy into workspace”
-In Properties -> Android -> in Project build target, uncheck Android 2.2 and check Android 4.1.2
-In Java build path, uncheck if you have any .jar library, and uncheck the Dependence

and finally this is what you need to do. enter image description here

like image 23
Syeda Zunaira Avatar answered Oct 20 '22 05:10

Syeda Zunaira