Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Failed Resolution of R$Drawable when using a bound Java Library

I am binding the java library Material CalendarView. With a set of 12 transforms in Metadata.xml I could bind the library with 0 errors and 15 warnings. I have added Support Library v4 Component ver 23.1.1 in the binding project as the jar file had a dependency on that. Also I have ensured that all the Resource assets are included in the jar file.

When I use this library in an Android Sample like below,

var materialCalendar= new MaterialCalendarView(this);

this exception gets thrown

Failed resolution of: Lcom/prolificinteractive/materialcalendarview/R$drawable; Java.Lang.NoClassDefFoundError: Failed resolution of: Lcom/prolificinteractive/materialcalendarview/R$drawable; ---> Java.Lang.ClassNotFoundException: Didn't find class "com.prolificinteractive.materialcalendarview.R$drawable" on path: DexPathList[[zip file "/data/app/com.fingent.materialcalendarsample-1/base.apk"],nativeLibraryDirectories=[/data/app/com.fingent.materialcalendarsample-1/lib/x86, /vendor/lib, /system/lib]] at --- End of managed exception stack trace --- at java.lang.ClassNotFoundException: Didn't find class "com.prolificinteractive.materialcalendarview.R$drawable" on path: DexPathList[[zip file "/data/app/com.fingent.materialcalendarsample-1/base.apk"],nativeLibraryDirectories=[/data/app/com.fingent.materialcalendarsample-1/lib/x86, /vendor/lib, /system/lib]] at at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at at java.lang.ClassLoader.loadClass(ClassLoader.java:469) at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.setupChildren(MaterialCalendarView.java:358) at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.<init>(MaterialCalendarView.java:237) at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.<init>(MaterialCalendarView.java:216) at at md56fd5622393123d59c6c51d78708f2ed2.MainActivity.n_onCreate(Native Method) at at md56fd5622393123d59c6c51d78708f2ed2.MainActivity.onCreate(MainActivity.java:28) at at android.app.Activity.performCreate(Activity.java:5990) at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) at at android.app.ActivityThread.access$800(ActivityThread.java:151) at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) at at android.os.Handler.dispatchMessage(Handler.java:102) at at android.os.Looper.loop(Looper.java:135) at at android.app.ActivityThread.main(ActivityThread.java:5254) at at java.lang.reflect.Method.invoke(Native Method) at at java.lang.reflect.Method.invoke(Method.java:372) at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) at Suppressed: java.lang.ClassNotFoundException: com.prolificinteractive.materialcalendarview.R$drawable at at java.lang.Class.classForName(Native Method) at at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at at java.lang.ClassLoader.loadClass(ClassLoader.java:504) at ... 19 more at Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available --- End of inner exception stack trace --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (IntPtr jobject, IntPtr jclass, IntPtr jmethod, Android.Runtime.JValue* parms) [0x00084] in /Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1029 at Android.Runtime.JNIEnv.FinishCreateInstance (IntPtr instance, IntPtr jclass, IntPtr constructorId, Android.Runtime.JValue* constructorParameters) [0x0000b] in /Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:306 at MaterialCalendarLibrary.MaterialCalendarView..ctor (Android.Content.Context p0) [0x000c5] in /Users/fingent/Projects/MaterialCalendarLibrary/MaterialCalendarLibrary/obj/Release/generated/src/MaterialCalendarLibrary.MaterialCalendarView.cs:505 at MaterialCalendarSample.MainActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x00009] in /Users/fingent/Documents/sreeraj/workspace/Xamarin.MaterialCalendarView/MaterialCalendarSample/MainActivity.cs:17 at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState) [0x00011] in /Users/builder/data/lanes/3053/a94a03b5/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Android.App.Activity.cs:2475 at at (wrapper dynamic-method) System.Object:0b8c341c-2f19-42d5-83e9-b3a815827e69 (intptr,intptr,intptr) at --- End of managed exception stack trace --- at java.lang.NoClassDefFoundError: Failed resolution of: Lcom/prolificinteractive/materialcalendarview/R$drawable; at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.setupChildren(MaterialCalendarView.java:358) at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.<init>(MaterialCalendarView.java:237) at at com.prolificinteractive.materialcalendarview.MaterialCalendarView.<init>(MaterialCalendarView.java:216) at at md56fd5622393123d59c6c51d78708f2ed2.MainActivity.n_onCreate(Native Method) at at md56fd5622393123d59c6c51d78708f2ed2.MainActivity.onCreate(MainActivity.java:28) at at android.app.Activity.performCreate(Activity.java:5990) at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) at at android.app.ActivityThread.access$800(ActivityThread.java:151) at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) at at android.os.Handler.dispatchMessage(Handler.java:102) at at android.os.Looper.loop(Looper.java:135) at at android.app.ActivityThread.main(ActivityThread.java:5254) at at java.lang.reflect.Method.invoke(Native Method) at at java.lang.reflect.Method.invoke(Method.java:372) at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) at Caused by: java.lang.ClassNotFoundException: Didn't find class "com.prolificinteractive.materialcalendarview.R$drawable" on path: DexPathList[[zip file "/data/app/com.fingent.materialcalendarsample-1/base.apk"],nativeLibraryDirectories=[/data/app/com.fingent.materialcalendarsample-1/lib/x86, /vendor/lib, /system/lib]] at at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at at java.lang.ClassLoader.loadClass(ClassLoader.java:469) at ... 18 more at Suppressed: java.lang.ClassNotFoundException: com.prolificinteractive.materialcalendarview.R$drawable at at java.lang.Class.classForName(Native Method) at at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at at java.lang.ClassLoader.loadClass(ClassLoader.java:504) at ... 19 more at Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

Here is the link to the project in Github Xamarin Material CalendarView

Best Answer

Answers

Sign In or Register to comment.