athkalia/Just-Another-Android-App

While app launch: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/stetho/Stetho

souri opened this issue · 4 comments

souri commented

Environment: Android Studio 2.23
Gradle: 3.2.1

The stack trace is here:

E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.example.develop, PID: 4309
                  java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/stetho/Stetho;
                      at com.example.util.StethoToolImpl.init(StethoToolImpl.java:24)
                      at com.example.App.initStetho(App.java:93)
                      at com.example.App.onCreate(App.java:32)
                      at com.android.tools.fd.runtime.BootstrapApplication.onCreate(BootstrapApplication.java:370)
                      at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1036)
                      at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5492)
                      at android.app.ActivityThread.-wrap2(ActivityThread.java)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1571)
                      at android.os.Handler.dispatchMessage(Handler.java:102)
                      at android.os.Looper.loop(Looper.java:154)
                      at android.app.ActivityThread.main(ActivityThread.java:6209)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
E/AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.stetho.Stetho" on path: DexPathList[[dex file "/data/data/com.example.develop/files/instant-run/dex/slice-support-annotations-25.1.1_dfefee911e18261d2128ab14c28ff3558b0a6e4e-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-retrofit-mock-2.1.0_20acf898747ed2b5aea8574ad8b28a56e295c7bd-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-retrofit-2.1.0_d08a4fe87b2eedd5fcddf3c1613c08274b04542b-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-okio-1.9.0_5b3627987d6cb4bcccd7450ffe5951f2b7e40eea-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-nl.littlerobots.rxlint-rxlint-1.1_1267bf6a80c8f1d546a2834b1934cebadede0fa7-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-mvp-common-2.0.1_8e3316f36c2fb44012af1712b007de9d56e9e2df-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-logging-interceptor-3.4.2_f6bef079f71b174b0a377cc156a745543e889458-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-javax.inject-1_95309d88f62e0e5ae92674ebc77695ae406206a4-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-io.reactivex-rxandroid-1.2.1_607f4bcd5845bc6492191050ded4a61ed1d51fd0-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-io.fabric.sdk.android-fabric-1.3.14_1e0a9a9d0a06273d8a6ad5b7e53a8d055e92edc6-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-gson-2.7_383633617374820f09d175a61ba649b649396bca-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-dagger-2.7_1a87ca17ae0b9929681ad7246648556e27329938-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-converter-gson-2.1.0_e8e506bc66855717700ce98d82f021729957e054-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-commons-cli-1.2_96c24d7520f35645d6371a1082a8728ea8781ef5-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.jakewharton.timber-timber-4.5.1_76b27343422d69f488c8c7ac1cd46d9ebcd56523-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.jakewharton-butterknife-8.5.1_e9bdc7c02c1db4264ae2f2144306d6e8eccb2992-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.hannesdorfmann.mosby-viewstate-2.0.1_a5a0954275db8764deba9476390d32aae9b160d7-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.hannesdorfmann.mosby-mvp-2.0.1_6aa0b174f54ed73a38ead4c616d8fa33ba232e94-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.facebook.stetho-stetho-okhttp3-1.4.2_c2660d1bc97134c9f85eed142be688e5ef1ad4a1-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.facebook.android-facebook-android-sdk-4.10.0_06a008f9c7fe54133e79d203829a3073632bec9a-classes
E/AndroidRuntime: .dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.crashlytics.sdk.android-crashlytics-core-2.3.14_6cf2eb24d5b258b549423db7e9cf52e7b6bd407f-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.crashlytics.sdk.android-crashlytics-2.6.5_16af0bf55b4c81f01f8c366f2577bf6731b6e3e4-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.crashlytics.sdk.android-beta-1.2.2_d70c92730da784e744687cf6ac5f171124a4a754-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.crashlytics.sdk.android-answers-1.3.10_02615646608fe8dcf1e8685d880c6ec0c2669897-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support.test.espresso-espresso-idling-resource-2.2.2_62809e7264bcd1018b825d078ccf623c9928a3cd-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-support-vector-drawable-25.1.1_80e413894e3895c57c6cd5511cb5f13315dbe515-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-support-v4-25.1.1_64eb787ff00381bd39de19f241da92c7c22d9695-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-support-media-compat-25.1.1_227b3fc179969b390ffef7d1f40e14e585565608-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-support-fragment-25.1.1_4a6dcd1af950af471bd79da072210ee7ddf7fc3a-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-support-core-utils-25.1.1_15ecf2a0ff46e4e396629230e3c2b226dee24c5e-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-support-core-ui-25.1.1_e1e1ccbe1a3683ce8d4a152029f56ee1e9a38e0c-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-support-compat-25.1.1_addfabc2846c9ce368ff749697e01e6e0f6c3dd2-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-recyclerview-v7-25.1.1_84a5e65d606d4bfc81172b51da992051e168f044-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-multidex-1.0.1_6e558d4b5533beb308b8fb20613be4a5c87f2e3e-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-cardview-v7-23.4.0_2f158647b14988d7fec4152a937479b2e016a388-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-appcompat-v7-25.1.1_c67f60d5c86f2a02499744b126452c32d5ceb14b-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-animated-vector-drawable-25.1.1_3e2ef11865299d7e77f495c1f776d0d8683a62f5-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-butterknife-annotations-8.5.1_c624622a7361f1b94a0ecb56778b100c13132ea1-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-bolts-tasks-1.3.0_ca831ced3df47f5762172a380e06fd22af4150ef-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-bolts-applinks-1.3.0_75ce204d49f8c7d7bc7633845970b427ae934954-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-annotations-2.0.1_e40182c42347edfcee33760093b1997d7faf5f2d-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-adapter-rxjava-2.1.0_7f6d2a0d04e52fa760d394e9a2a115433c462092-classes.dex"],nativeLibraryDirectories=[/data/app/com.example.develop-1/lib/arm64, /system/lib64, /vendor/lib64]]
                      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                      at com.android.tools.fd.runtime.IncrementalClassLoader$DelegateClassLoader.findClass(IncrementalClassLoader.java:90)
                      at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
                      at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime: 	... 14 more

Any ideas how to fix it?

Hey there, thanks for raising this. Can you give me a few more details on when this is happening?

souri commented

Thanks for the response @athkalia. I'll try to explain the steps to reproduce it:

Steps

  1. Clone your repo
  2. Open it up in Android Studio
  3. Sync project files with Gradle
  4. Run the debug build variant it on a connected Android N device (I don't get any issues on the release variant)
  5. The app fails to launch with the above error and stack-trace

Note:

  1. I've changed the build tools version to 25.0.2, before syncing, because somehow although I had installed 25.0.1, Gradle could not find it.
  2. I tried some changes and now getting a different error
W/System: ClassLoader referenced unknown path: /data/app/com.example.develop-2/lib/arm64
I/art: Rejecting re-init on previously-failed class java.lang.Class<okhttp3.logging.HttpLoggingInterceptor>: java.lang.NoClassDefFoundError: Failed resolution of: Lokhttp3/Interceptor;

I'm not able to rule out if it's some environment issue.

souri commented

Just changing back buildToolsVersion to 25.0.1 from 25.0.2 fixed it for me. Sorry for bothering you! Let me know why the incompatibility with 25.0.2 if you can though. I'll close the issue,

Alright great : >
I'll give you a shout when I upgrade