0

I am receiving an exception (via Crashlytics) as follows:

java.lang.NoClassDefFoundError: com.example.android.R$drawable at com.example.android.adapters.ExampleAdapter.(ExampleAdapter.java:59) at com.example.android.activities.Dashboard.onCreate(Dashboard.java) at android.app.Activity.performCreate(Activity.java:5152) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) at android.app.ActivityThread.access$600(ActivityThread.java:141) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5056) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:840) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607) at dalvik.system.NativeStart.main(NativeStart.java)

My code at that line is as follows (line 59 refers to showStubImage):

contactImageOptions = new DisplayImageOptions.Builder()
            .showStubImage(R.drawable.default_contact)
            .showImageOnFail(R.drawable.default_contact)
            .showImageForEmptyUri(R.drawable.default_contact)
            .cacheInMemory(true)
            .cacheOnDisc(true)
            .build();

I cannot reproduce this exception on my IDE and its seems that not all my users get this. The drawable "default_contact" does exist on the IDE and is part of the project (i.e it does not come from a library). I have also noticed that 92% of the users getting this exception are from Amazon devices.

checklist
  • 12,340
  • 15
  • 58
  • 102

1 Answers1

0

I got the same exception when I moved *.java file from "app" to new created module (on Android Studio).

This java file referenced to R.drawable.com_facebook_profile_default_icon Facebook module resource.

The problem was solved simply by rebuild the project.

Shlomi Hasin
  • 443
  • 7
  • 12