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

匿名 (未验证) 提交于 2019-12-03 01:26:01

问题:

I tried using okhttp and picasso (following this answer) for disk caching of images that was i downloading from firebase storage.Now app gives exception and crashes.I have seen these posts post 1,post 2 but no relevent solution is found.i also tried to clean and rebuild project but no luck.

Here is build.gradle

        apply plugin: 'com.android.application'  android {     compileSdkVersion 25     buildToolsVersion "25.0.2"     defaultConfig {         applicationId "social.com.networking.social.media.app"         minSdkVersion 16         targetSdkVersion 25         versionCode 1         versionName "1.0"         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"     }     buildTypes {         release {             minifyEnabled false             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'             multiDexEnabled true           }     } }  dependencies {     compile fileTree(dir: 'libs', include: ['*.jar'])     androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {         exclude group: 'com.android.support', module: 'support-annotations'     })     compile 'com.android.support:appcompat-v7:25.1.0'     compile 'com.android.support:design:25.1.0'     compile 'br.com.mauker.materialsearchview:materialsearchview:1.2.0'     compile 'com.alirezaafkar:toolbar:1.1.1'     compile 'com.github.mancj:MaterialSearchBar:0.3.5'     compile 'com.squareup.picasso:picasso:2.5.2'     compile 'com.nineoldandroids:library:2.4.0'     compile 'com.daimajia.slider:library:1.1.5@aar'     compile 'com.google.code.gson:gson:2.6.2'     compile 'com.google.firebase:firebase-core:10.0.1'     compile 'com.google.firebase:firebase-ads:10.0.1'     compile 'com.google.firebase:firebase-messaging:10.0.1'     compile "com.google.firebase:firebase-auth:10.0.1"     compile 'com.google.firebase:firebase-storage:10.0.1'     compile 'com.google.firebase:firebase-crash:10.0.1'     compile 'com.squareup.okhttp3:okhttp:3.2.0'     compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.2'     compile 'com.android.support:multidex:1.0.1'      compile 'org.parceler:parceler-api:1.1.6'     annotationProcessor 'org.parceler:parceler:1.1.6'       testCompile 'junit:junit:4.12' } apply plugin: 'com.google.gms.google-services' 

Full Stacktrace

Edit -1: i have enabled multidex as Redman said but still gives same error.According to this developer.android.com/studio/build/multidex.html#keep i need to decide which classes are necessary in base apk .how i determine which classes are necessary?

回答1:

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



回答2:

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'  } 


回答3:

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



回答4:

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.



回答5:

Try removing .gradle folder from project.



回答6:

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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!