AndroidStudio上的错误java.lang.NoClassDefFoundError:使用引导类加载器找不到类;没有堆栈跟踪可用

时间:2017-10-22 16:07:19

标签: java android error-handling

当我的应用程序崩溃时,我收到了这个错误。 我确实为这个错误找到了一些答案,但没有一个有效。

它有时发生在我运行应用程序时它会粉碎,有时候我点击一个Btn ......

这里是完整的错误:

10-22 18:19:09.000 17119-17119/? E/AndroidRuntime: FATAL EXCEPTION: main
                                               Process: com.example.natali.cooktogther, PID: 17119
                                               java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/internal/zzac;
                                                   at com.google.firebase.storage.FirebaseStorage.getInstance(Unknown Source)
                                                   at com.example.natali.cooktogther.PostActivity.onCreate(PostActivity.java:43)
                                                   at android.app.Activity.performCreate(Activity.java:6272)
                                                   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2387)
                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)
                                                   at android.app.ActivityThread.access$900(ActivityThread.java:157)
                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356)
                                                   at android.os.Handler.dispatchMessage(Handler.java:102)
                                                   at android.os.Looper.loop(Looper.java:148)
                                                   at android.app.ActivityThread.main(ActivityThread.java:5527)
                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
                                                Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzac" on path: DexPathList[[zip file "/data/app/com.example.natali.cooktogther-2/base.apk", zip file "/data/app/com.example.natali.cooktogther-2/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.natali.cooktogther-2/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.natali.cooktogther-2/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.natali.cooktogther-2/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.natali.cooktogther-2/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.natali.cooktogther-2/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.natali.cooktogther-2/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.natali.cooktogther-2/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.natali.cooktogther-2/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.natali.cooktogther-2/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.natali.cooktogther-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.natali.cooktogther-2/lib/arm, /vendor/lib, /system/lib]]
                                                   at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                   at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                                                   at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                                                   at com.google.firebase.storage.FirebaseStorage.getInstance(Unknown Source) 
                                                   at com.example.natali.cooktogther.PostActivity.onCreate(PostActivity.java:43) 
                                                   at android.app.Activity.performCreate(Activity.java:6272) 
                                                   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) 
                                                   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2387) 
                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494) 
                                                   at android.app.ActivityThread.access$900(ActivityThread.java:157) 
                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1356) 
                                                   at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                   at android.os.Looper.loop(Looper.java:148) 
                                                   at android.app.ActivityThread.main(ActivityThread.java:5527) 
                                                   at java.lang.reflect.Method.invoke(Native Method) 
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730) 
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620) 
                                                Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.common.internal.zzac
                                                   at java.lang.Class.classForName(Native Method)
                                                   at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
                                                   at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
                                                   at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                                                        ... 15 more
                                                Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

编辑:Gradle文件:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.example.natali.cooktogther"
        minSdkVersion 21
        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'
        }
    }
}

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.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.firebase:firebase-auth:10.0.1'
    compile 'com.google.firebase:firebase-database:10.0.1'
    compile 'com.google.firebase:firebase-storage:10.0.1'
    compile 'com.firebaseui:firebase-ui-database:2.0.0'
    compile 'com.theartofdev.edmodo:android-image-cropper:2.3.+'
    compile 'com.android.support:cardview-v7:25.+'
    compile 'com.android.support:recyclerview-v7:25.+'
    testCompile 'junit:junit:4.12'
}





apply plugin: 'com.google.gms.google-services'

如果需要更多我会添加...... 谢谢大家帮忙...... :d

0 个答案:

没有答案