Class not found using the boot class loader; no stack trace available

ぃ、小莉子 提交于 2019-12-05 05:36:52

Got the solution ,it is happening because of instant run, Just disable it

Goto :

Android Studio --> File --> Setting --> Build, execution, deploy -->  Instant run.

No need to disable instant run, just remove the app from device/emulator and clean the project and install it again.

For me the problem was that the Gradle dependencies wen't matching. Here's what solved it for me:

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
    applicationId "com.and.myApp"
    minSdkVersion 19
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    externalNativeBuild {
        cmake {
            cppFlags "-fexceptions"
        }
    }
}


dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'jp.wasabeef:blurry:2.1.1'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})

compile 'com.android.support.constraint:constraint-layout:1.0.2'


//noinspection GradleCompatible
compile 'com.android.support:cardview-v7:25.3.1'

compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.+'

}

For me, it is after I add the code to use getFusedLocationProviderClient, I get crashes

process: no.onmyway133.myapp, PID: 10538
    java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/api/Api$zzf;
        at com.google.android.gms.location.LocationServices.<clinit>(Unknown Source)
        at com.google.android.gms.location.LocationServices.getFusedLocationProviderClient(Unknown Source)
        at no.onmyway133.myapp.maps.MapsActivity.onCreate(MapsActivity.kt:22)

The problem is the warning in build.gradle, it warns that both should use the same version, otherwise there will be potential for runtime crashes.

So the fix is to specify the same version

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