Java.lang.NoClassDefFoundError exception: android.support.v7.appcompat.R $ style

Hi everyone, I get an exception when working with lib support. I know a lot of questions and answers are available in SO, but no one works 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 did was: I have android-support-v7-appcompat.jar as well as android-support-v4.jar support in the javascript build path.

In some answer in SO, it was suggested that I also tried uncontrolled Android dependencies in the java build path, but nothing worked for me.

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

+6
source share
5 answers

Import the support.v7.appcompat file as a library project into the workspace and attach it to your project.

Try it, it will work for sure. if you still encounter any problem, make a comment.

+2
source

You just need to uninstall the application and re-import it to eclipse and change its built-in Android property for maximum api configuration. Clean your project, copy the R file into the gen package and change the project build path to the highest level api, for example api-21.

This will solve your problem.

+2
source

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

 -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

+1
source

Try importing v7 appcompat with resources for your project, and not directly using a .jar file.

Here is the link for importing appcompat with resources - https://developer.android.com/tools/support-library/setup.html

If you encounter problems in your project after importing v7 appcompat, drag the target version of sdk to the manifest and install the target version of sdk in the latest version of sdk api.

Hope this helps!

0
source

The problem seems to be broader, but in my particular case it was caused by a collision between the following dependencies in build.gradle

 compile 'com.facebook.android:facebook-android-sdk:3.21.1' compile 'com.google.android.gms:play-services-plus:7.5.0' 
0
source

Source: https://habr.com/ru/post/978776/


All Articles