Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

删除回忆录丶 提交于 2019-11-28 20:42:41

In Android Studio 2.3 and higher, There is Instant Run which may affect your code.

Disable Instant Run

File -> Settings -> Build, Execution, Deployment -> Instant Run

In my case it was working perfect when run from Android Studio but crashing when install from other sources

1)Kindly uninstall the app from your mobile

2)Reinstall the app now from android studio

3)98% it will work else clean the project and reinstall it again

You may need to enable multidex, follow the guide from this

https://developer.android.com/studio/build/multidex.html ,for enabling multidex

  defaultConfig {

    minSdkVersion 14
    targetSdkVersion 21

    multiDexEnabled true
}

 dependencies {
     compile 'com.android.support:multidex:1.0.0'
 }

Just remove your project's build folder, then clean and run your application. This did the trick for me...

My Code way compiling well on the device using USB cable, but when I was trying to install it using *.apk file it was breaking, so I unchecked the option File -> Settings -> Build, Execution, Deployment -> Instant Run, but now its working fine with *.apk file and starting breaking with USB install, the error message is in the attachec image, even if I press OK it doesn't work, when I try yo install it again the same error message appears.

Try removing .gradle folder from project.

I've also had this problem, and it's still not possible to turn off the instant run.Later, I found that I deleted all the files under the build-cache folder, and then clean the project.My directory is C:\Users\ HDB . Android \ built-cache.I hope I can help other people who encounter this bug.

For me this problem was solved by Disable Instant Run

Just go to Preferences -> Build, Execution, Deployment -> Instant Run -> Disable the option

And restart the app

(I know this is an old question, but I came here looking for a solution to a similar problem.)

I have a different answer to consider before you exhaust all the other suggestions above: the ClassNotFoundException: YourParcelableClass error may not be the problem. In fact, it may not be a problem.

I have an app which displays a screen of various content which is passed in as a Parcelable and rendered as HTML in a WebView; it was working great until I cleaned up the code, checked it in, checked out a clean new tree, and uninstalled & reinstalled the app on my phone. I started getting a blank screen; obviously that ClassNotFoundException in the log meant my content was not being unmarshalled correctly.

After at least an hour of disabling Instant Run, rm -rf .gradle, Clean Project, Invalidate Caches & Restart, etc., etc., I started adding increasingly sanity-questioning logging until I figured out that I was getting my content from Intent.getParcelableExtra(); the blank screen appeared to be unrelated! (I still don't know why, but WebView.loadData() had stopped working, and had to be replaced with WebView.loadDataWithBaseURL().)

Hopefully this saves someone else an hour of stupidity. If you see that ClassNotFoundException with your class' name, check to see whether your objects are still being unmarshalled correctly; they might be!

I found another "answer" to the issue. I was getting the same error message using Android Studio 3.3.2. I decided to clear ALL breakpoints. On the breakpoints dialog there are two "permanant" options, Java Exception Breakpoints and Exception Breakpoints.   I had them both checked, by accident probably.   When I cleared them and other break points I could run under Debug mode. Now that debug is running I can add break points as long as those are not checked!

This error also occurs because of the differences in libraries' version specification that can lead to runtime errors. Always use same versions of libraries in build.gradle.
For example:

Use this:

implementation 'com.google.android.gms:play-services-location:11.6.0'
implementation 'com.google.android.gms:play-services-auth:11.6.0'

Instead of:

implementation 'com.google.android.gms:play-services-location:15.0.0'
implementation 'com.google.android.gms:play-services-auth:11.6.0'
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!