NoClassDefFoundError:棉花糖中的Ljava / util / stream / IntStream的解析失败

时间:2018-12-27 07:24:51

标签: java android java-8

在Android 5.0设备中获取运行时异常,并在Android 7.0中正常运行, 我们已经在项目中使用IntStream类,没有编译时错误,并且在执行应用程序时会抛出运行时异常。

我的构建gradle配置在这里:

compileSdkVersion 27
defaultConfig {
    applicationId "com.mypackage.app"
    minSdkVersion 19
    targetSdkVersion 27
    versionCode 2
    versionName "2.0"
    multiDexEnabled true
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}     compileOptions {
    sourceCompatibility 1.8
    targetCompatibility 1.8
}

崩溃日志如下:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.mypackage.app, PID: 27713
    java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.
        at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:111)
        at android.os.Handler.handleCallback(Handler.java:746)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:148)
        at android.app.ActivityThread.main(ActivityThread.java:5443)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
     Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Ljava/util/stream/IntStream;
        at android.app.ActivityThread.main(ActivityThread.java:5443) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 
     Caused by: java.lang.ClassNotFoundException: Didn't find class "java.util.stream.IntStream" on path: DexPathList[[zip file "/data/app/com.fivevs-1/base.apk"],nativeLibraryDirectories=[/data/app/com.fivevs-1/lib/arm, /data/app/com.fivevs-1/base.apk!/lib/armeabi-v7a, /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 io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:109) 
        at android.os.Handler.handleCallback(Handler.java:746) 
        at android.os.Handler.dispatchMessage(Handler.java:95) 
        at android.os.Looper.loop(Looper.java:148) 
        at android.app.ActivityThread.main(ActivityThread.java:5443) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 
        Suppressed: java.lang.ClassNotFoundException: java.util.stream.IntStream
        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)
                ... 17 more
     Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

0 个答案:

没有答案