java - NoClassDefFoundError on implementing Runnable class in android studio -
i keep getting noclassdeffounderror on code. here code:
handler.postdelayed(check = new runnable() { @override public void run() { if (foreground && paused) { foreground = false; log.i(tag, "went background"); (listener l : listeners) { try { l.onbecamebackground(); } catch (exception exc) { log.e(tag, "listener threw exception!", exc); } } } else { log.i(tag, "still foreground"); } } } , check_delay);
the error occurs on assigning new runnable()
check
i tried separating runnable
, , tried no success
final runnable temp = new runnable() { @override public void run() { if (foreground && paused) { foreground = false; log.i(tag, "went background"); (listener l : listeners) { try { l.onbecamebackground(); } catch (exception exc) { log.e(tag, "listener threw exception!", exc); } } } else { log.i(tag, "still foreground"); } } }; handler.postdelayed(check = new runnable() { @override public void run() { if (foreground && paused) { foreground = false; log.i(tag, "went background"); (listener l : listeners) { try { l.onbecamebackground(); } catch (exception exc) { log.e(tag, "listener threw exception!", exc); } } } else { log.i(tag, "still foreground"); } } } , check_delay);
the error appears on line final runnable temp = new runnable() {
what happened? check compiled classes , files there. class , $ class. there solution or alternative?
edit (add error log):
08-31 10:54:51.672 17887-17887/com.travelio.traveliochatapp e/androidruntime﹕ fatal exception: main process: com.travelio.traveliochatapp, pid: 17887 java.lang.noclassdeffounderror: com.travelio.traveliochatapp.misc.foregroundhelper$1 @ com.travelio.traveliochatapp.misc.foregroundhelper.onactivitypaused(foregroundhelper.java:159) @ android.app.application.dispatchactivitypaused(application.java:217) @ android.app.activity.onpause(activity.java:1287) @ com.travelio.traveliochatapp.splashactivity.onpause(splashactivity.java:79) @ android.app.activity.performpause(activity.java:5335) @ android.app.instrumentation.callactivityonpause(instrumentation.java:1233) @ android.app.activitythread.performpauseactivity(activitythread.java:3138) @ android.app.activitythread.performpauseactivity(activitythread.java:3107) @ android.app.activitythread.handlepauseactivity(activitythread.java:3085) @ android.app.activitythread.access$1000(activitythread.java:144) @ android.app.activitythread$h.handlemessage(activitythread.java:1257) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:212) @ android.app.activitythread.main(activitythread.java:5137) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:515) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:902) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:718) @ dalvik.system.nativestart.main(native method)
ah, got it. use multidex in application , forgot add android:name="android.support.multidex.multidexapplication"
in androidmanifest.xml
. adding solve problem although chose trim codes wouldn't have use multidex
Comments
Post a Comment