java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/appcompat/R$styleable

ChrisSimChrisSim SGMember ✭✭
edited March 2015 in Xamarin.Android

Hi, got the following errors while I compile my app in release build tested on HTC One M8, Android 5.0

[MonoDroid] UNHANDLED EXCEPTION: [MonoDroid] Java.Lang.NoClassDefFoundError: Exception of type 'Java.Lang.NoClassDefFoundError' was thrown. [MonoDroid] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x00028> [MonoDroid] at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue[]) <0x000e7> [MonoDroid] at Android.App.Activity.OnCreate (Android.OS.Bundle) <0x001f3> [MonoDroid] at Dailyvanity.Droid.MainActivity.OnCreate (Android.OS.Bundle) <0x0001b> [MonoDroid] at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) <0x0005b> [MonoDroid] at (wrapper dynamic-method) object.8fd7059e-42b2-49fb-83a4-2573c08b970a (intptr,intptr,intptr) <0x00043> [MonoDroid] --- End of managed exception stack trace --- [MonoDroid] java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/appcompat/R$styleable; [MonoDroid] at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:147) [MonoDroid] at android.support.v7.app.ActionBarActivityDelegateBase.onCreate(ActionBarActivityDelegateBase.java:138) [MonoDroid] at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:123) [MonoDroid] at dailyvanity.droid.MainActivity.n_onCreate(Native Method) [MonoDroid] at dailyvanity.droid.MainActivity.onCreate(MainActivity.java:37) [MonoDroid] at android.app.Activity.performCreate(Activity.java:5958) [MonoDroid] at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1129) [MonoDroid] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364) [MonoDroid] at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2474) [MonoDroid] at android.app.ActivityThread.access$800(ActivityThread.java:144) [MonoDroid] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1359) [MonoDroid] at android.os.Handler.dispatchMessage(Handler.java:102) [MonoDroid] at android.os.Looper.loop(Looper.java:155) [MonoDroid] at android.app.ActivityThread.main(ActivityThread.java:5696) [MonoDroid] at java.lang.reflect.Method.invoke(Native Method) [MonoDroid] at java.lang.reflect.Method.invoke(Method.java:372) [MonoDroid] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028) [MonoDroid] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823) [MonoDroid] Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.appcompat.R$styleable" on path: DexPathList[[zip file "/data/app/com.dailyvanity.android-1/base.apk"],nativeLibraryDirectories=[/data/app/com.dailyvanity.android-1/lib/arm, /system/lib, /vendor/lib, system/vendor/lib, system/vendor/lib/egl, system/lib/hw]] [MonoDroid] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) [MonoDroid] at java.lang.ClassLoader.loadClass(ClassLoader.java:511) [MonoDroid] at java.lang.ClassLoader.loadClass(ClassLoader.java:469) [MonoDroid] ... 18 more [MonoDroid] Suppressed: java.lang.ClassNotFoundException: android.support.v7.appcompat.R$styleable [MonoDroid] at java.lang.Class.classForName(Native Method) [MonoDroid] at java.lang.BootClassLoader.findClass(ClassLoader.java:781) [MonoDroid] at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) [MonoDroid] at java.lang.ClassLoader.loadClass(ClassLoader.java:504) [MonoDroid] ... 19 more [MonoDroid] Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available [mono] [mono] Unhandled Exception: [mono] Java.Lang.NoClassDefFoundError: Exception of type 'Java.Lang.NoClassDefFoundError' was thrown. [mono] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x00028> [mono] at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue[]) <0x000e7> [mono] at Android.App.Activity.OnCreate (Android.OS.Bundle) <0x001f3> [mono] at Dailyvanity.Droid.MainActivity.OnCreate (Android.OS.Bundle) <0x0001b> [mono] at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) <0x0005b> [mono] at (wrapper dynamic-method) object.8fd7059e-42b2-49fb-83a4-2573c08b970a (intptr,intptr,intptr) <0x00043> [mono] [mono] --- End of managed exception stack trace --- [mono] java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/appcompat/R$styleable; [mono] at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:147) [mono] at android.support.v7.app.ActionBarActivityDelegateBase.onCreate(ActionBarActivityDelegateBase.java:138) [mono] at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:123) [mono] at dailyvanity.droid.MainActivity.n_onCreate(Native Method) [mono] at dailyvanity.droid.MainActivity.onCreate(MainActivity.java:37) [mono] at android.app.Activity.performCreate(Activity.java:5958) [mono] at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1129) [mono] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364) [mono] at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2474) [mono] at android.app.ActivityThread.access$800(ActivityThread.java:144) [mono] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1359) [mono] at android.os.Handler.dispatchMessage(Handler.java:102) [mono] at android.os.Looper.loop(Looper.java:155) [mono] at android.app.ActivityThread.main(ActivityThread.java:5696) [mono] at java.lang.reflect.Method.invoke(Native Method) [mono] at java.lang.reflect.Method.invoke(Method.java:372) [mono] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028) [mono] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823) [mono] Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.appcompat.R$styleable" on path: DexPathList[[zip file "/data/app/com.dailyvanity.android-1/base.apk"],nativeLibraryDirectories=[/data/app/com.dailyvanity.android-1/lib/arm, /system/lib, /vendor/lib, system/vendor/lib, system/vendor/lib/egl, system/lib/hw]] [mono] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) [mono] at java.lang.ClassLoader.loadClass(ClassLoader.java:511) [mono] at java.lang.ClassLoader.loadClass(ClassLoader.java:469) [mono] ... 18 more [mono] Suppressed: java.lang.ClassNotFoundException: android.support.v7.appcompat.R$styleable [mono] at java.lang.Class.classForName(Native Method) [mono] at java.lang.BootClassLoader.findClass(ClassLoader.java:781) [mono] at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) [mono] at java.lang.ClassLoader.loadClass(ClassLoader.java:504) [mono] ... 19 more [mono] Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available [mono] [mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: Java.Lang.NoClassDefFoundError: Exception of type 'Java.Lang.NoClassDefFoundError' was thrown. [mono-rt] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x00028> [mono-rt] at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue[]) <0x000e7> [mono-rt] at Android.App.Activity.OnCreate (Android.OS.Bundle) <0x001f3> [mono-rt] at Dailyvanity.Droid.MainActivity.OnCreate (Android.OS.Bundle) <0x0001b> [mono-rt] at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) <0x0005b> [mono-rt] at (wrapper dynamic-method) object.8fd7059e-42b2-49fb-83a4-2573c08b970a (intptr,intptr,intptr) <0x00043> [mono-rt] [mono-rt] --- End of managed exception stack trace --- [mono-rt] java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/appcompat/R$styleable; [mono-rt] at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:147) [mono-rt] at android.support.v7.app.ActionBarActivityDelegateBase.onCreate(ActionBarActivityDelegateBase.java:138) [mono-rt] at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:123) [mono-rt] at dailyvanity.droid.MainActivity.n_onCreate(Native Method) [mono-rt] at dailyvanity.droid.MainActivity.onCreate(MainActivity.java:37) [mono-rt] at android.app.Activity.performCreate(Activity.java:5958) [mono-rt] at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1129) [mono-rt] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364) [mono-rt] at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2474) [mono-rt] at android.app.ActivityThread.access$800(ActivityThread.java:144) [mono-rt] at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1359) [mono-rt] at android.os.Handler.dispatchMessage(Handler.java:102) [mono-rt] at android.os.Looper.loop(Looper.java:155) [mono-rt] at android.app.ActivityThread.main(ActivityThread.java:5696) [mono-rt] at java.lang.reflect.Method.invoke(Native Method) [mono-rt] at java.lang.reflect.Method.invoke(Method.java:372) [mono-rt] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028) [mono-rt] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823) [mono-rt] Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.appcompat.R$styleable" on path: DexPathList[[zip file "/data/app/com.dailyvanity.android-1/base.apk"],nativeLibraryDirectories=[/data/app/com.dailyvanity.android-1/lib/arm, /system/lib, /vendor/lib, system/vendor/lib, system/vendor/lib/egl, system/lib/hw]] [mono-rt] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) [mono-rt] at java.lang.ClassLoader.loadClass(ClassLoader.java:511) [mono-rt] at java.lang.ClassLoader.loadClass(ClassLoader.java:469) [mono-rt] ... 18 more [mono-rt] Suppressed: java.lang.ClassNotFoundException: android.support.v7.appcompat.R$styleable [mono-rt] at java.lang.Class.classForName(Native Method) [mono-rt] at java.lang.BootClassLoader.findClass(ClassLoader.java:781) [mono-rt] at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) [mono-rt] at java.lang.ClassLoader.loadClass(ClassLoader.java:504) [mono-rt] ... 19 more [mono-rt] Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available [mono-rt]

I think its might be cause due to my style but am I doing anything wrong on the below style?

<?xml version="1.0" encoding="UTF-8" ?> <resources> <style name="AppTheme" parent="@style/Theme.AppCompat.Light.NoActionBar"> <item name="android:actionBarStyle">@style/MyActionBar</item> <item name="android:actionBarTabTextStyle">@style/MyActionBarTabText</item> <item name="android:actionMenuTextColor">@color/text_colour</item> <item name="android:actionBarTabStyle">@style/MyActionBarTab</item> <item name="android:windowNoTitle">true</item> <!--We will be using the toolbar so no need to show ActionBar--> <item name="android:windowActionBar">false</item> </style> <!-- ActionBar styles --> <style name="MyActionBar" parent="@android:style/Widget.Holo.ActionBar"> <item name="android:background">@color/actionbar_background</item> <item name="android:titleTextStyle">@style/MyActionBarTitleText</item> </style> <!-- ActionBar title text --> <style name="MyActionBarTitleText" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title"> <item name="android:textColor">@color/text_colour</item> </style> <!-- ActionBar tabs text styles --> <style name="MyActionBarTabText" parent="@android:style/Widget.Holo.ActionBar.TabText"> <item name="android:textColor">@color/tabTextColour</item> <item name="android:gravity">center</item> </style> <!-- ActionBar tabs text styles --> <style name="MyActionBarTab" parent="@android:style/Widget.Holo.ActionBar.TabView"> </style> </resources>

Answers

  • ChrisSimChrisSim SGMember ✭✭
    edited March 2015

    Kinda solve my own problem.

    Its cause by theme style. It seems that the android.support.v7.appcombat don't have "Theme.AppCompat.Light" class, changing it to "Theme.AppCompat" and it work.

    If anyone having the same issue, you can try the following steps I did.

    • Remove Android Support Library 7
    • Remove Google Play Service
    • Do a project clean up
    • Add back the library

    My new style after cleaning up is as below.

    <?xml version="1.0" encoding="UTF-8" ?> <resources> <style name="AppTheme" parent="@style/Theme.AppCompat.NoActionBar"> <item name="android:windowActionBar">false</item> <item name="android:windowNoTitle">true</item> <!--We will be using the toolbar so no need to show ActionBar--> </style> </resources>

  • AntonioStanAntonioStan USMember

    Hello, does anyone solved this? I tried changing the style, removing components, re-adding components, clean/build... still no result, still facing this issue...

    10-10 09:09:48.489 E/mono-rt ( 3088): [ERROR] FATAL UNHANDLED EXCEPTION: Java.Lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/appcompat/R$styleable; ---> Java.Lang.ClassNotFoundException: Didn't find class "android.support.v7.appcompat.R$styleable" on path: DexPathList[[zip file "/data/app/com.ortec.omegatest-1/base.apk"],nativeLibraryDirectories=[/data/app/com.ortec.omegatest-1/lib/x86, /data/app/com.ortec.omegatest-1/base.apk!/lib/x86, /vendor/lib, /system/lib]]
    10-10 09:09:48.489 E/mono-rt ( 3088):    --- End of inner exception stack trace ---
    10-10 09:09:48.489 E/mono-rt ( 3088):   --- End of managed Java.Lang.NoClassDefFoundError stack trace ---
    10-10 09:09:48.489 E/mono-rt ( 3088): java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/appcompat/R$styleable;
    10-10 09:09:48.489 E/mono-rt ( 3088):   at android.support.v7.app.AppCompatDelegateImplV7.createSubDecor(AppCompatDelegateImplV7.java:339)
    10-10 09:09:48.489 E/mono-rt ( 3088):   at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:312)
    10-10 09:09:48.489 E/mono-rt ( 3088):   at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:277)
    10-10 09:09:48.489 E/mono-rt ( 3088):   at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
    10-10 09:09:48.489 E/mono-rt ( 3088):   at md5c7377c005bd442b084ddaa5ed5b2e134.Main.n_onCreate(Native Method)
    10-10 09:09:48.489 E/mono-rt ( 3088):   at md5c7377c005bd442b084ddaa5ed5b2e134.Main.onCreate(Main.java:35)
    10-10 09:09:48.489 E/mono-rt ( 3088):   at android.app.Activity.performCreate(Activity.java:6237)
    10-10 09:09:48.489 E/mono-rt ( 3088):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
    10-10 09:09:48.489 E/mono-rt ( 3088):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
    10-10 09:09:48.489 E/mono-rt ( 3088):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
    10-10 09:09:48.489 E/mono-rt ( 3088):   at android.app.ActivityThread.-wrap11(ActivityThread.java)
    10-10 09:09:48.489 E/mono-rt ( 3088):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
    10-10 09:09:48.489 E/mono-rt ( 3088):   at android.os.Handler.dispatchMessage(Handler.java:102)
    10-10 09:09:48.489 E/mono-rt ( 3088):   at android.os.Looper.loop(Looper.java:148)
    10-10 09:09:48.489 E/mono-rt ( 3088):   at android.app.ActivityThread.main(ActivityThread.java:5417)
    10-10 09:09:48.489 E/mono-rt ( 3088):   at java.lang.reflect.Method.invoke(Native Method)
    10-10 09:09:48.489 E/mono-rt ( 3088):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    10-10 09:09:48.489 E/mono-rt ( 3088):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    10-10 09:09:48.489 E/mono-rt ( 3088): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.appcompat.R$styleable" on path: DexPathList[[zip file "/data/app/com.ortec.omegatest-1/base.apk"],nativeLibraryDirectories=[/data/app/com.ortec.omegatest-1/lib/x86, /data/app/com.ortec.omegatest-1/base.apk!/lib/x86, /vendor/lib, /system/lib]]
    10-10 09:09:48.489 E/mono-rt ( 3088):   at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    10-10 09:09:48.489 E/mono-rt ( 3088):   at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
    10-10 09:09:48.489 E/mono-rt ( 3088):   at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
    10-10 09:09:48.489 E/mono-rt ( 3088):   ... 18 more
    10-10 09:09:48.489 E/mono-rt ( 3088):   Suppressed: java.lang.ClassNotFoundException: android.support.v7.appcompat.R$styleable
    10-10 09:09:48.489 E/mono-rt ( 3088):       at java.lang.Class.classForName(Native Method)
    10-10 09:09:48.489 E/mono-rt ( 3088):       at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
    10-10 09:09:48.489 E/mono-rt ( 3088):       at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
    10-10 09:09:48.489 E/mono-rt ( 3088):       at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
    10-10 09:09:48.489 E/mono-rt ( 3088):       ... 19 more
    10-10 09:09:48.489 E/mono-rt ( 3088):   Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
    10-10 09:09:48.489 E/mono-rt ( 3088): 
    
  • BalazsBonisBalazsBonis USUniversity ✭✭

    I've solved this for one scenario (which might not apply to all of you):
    I created a completely new Xamarin.Forms Xaml based solution, and when I deployed, it blew up with this error message. It turns out my problem was that for some reason the default MainActivity class was defined to inherit from global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity by the code generation instead of the correct global::Xamarin.Forms.Platform.Android.FormsApplicationActivity.

    Fixing that solved the problem for me!

  • JeffreyHopperJeffreyHopper USMember

    This error occurred for me because a new image resources I added that contained a - (dash) character.

    Removed that character and my builds worked as normal

  • npinedanpineda Member ✭✭

    The same happened to me after i updated my VS. All other projects ran fine except for my Xamarin one. I could not find a proper solution. After spending hours nothing would work, so I had to nuke the whole thing and recreate from scratch using existing code. This is a shame! Xamarin has a long way to go, so many bugs, so many frustrations. Will continue developing for now... I kinda have to.

Sign In or Register to comment.