NoClassFoundError:java.util.stream.Stream

时间:2019-04-03 16:30:11

标签: android kotlin noclassdeffounderror

我正在使用Kotlin编写Android应用。

我收到java.util.stream.Stream的NoClassFoundError。

在我的应用中,我从来没有使用该类。

当我打开广告并出现在序列化过程中时,就会发生这种情况。 这并非在我所有的设备上都发生。仅适用于我的较老版本(5.1.1)。 并非所有活动都发生这种情况。

我猜想这与它试图序列化有关。但是,我不确定从哪里开始。

    java.lang.NoClassDefFoundError: java.util.stream.Stream
    at libcore.reflect.InternalNames.getClass(InternalNames.java:55)
    at java.lang.Class.getDexCacheType(Class.java:479)
    at java.lang.reflect.ArtMethod.getDexCacheType(ArtMethod.java:191)
    at java.lang.reflect.ArtMethod.getReturnType(ArtMethod.java:145)
    at java.lang.reflect.Method.getReturnType(Method.java:184)
    at java.lang.Class.getDeclaredMethods(Class.java:771)
    at java.io.ObjectStreamClass.computeSerialVersionUID(ObjectStreamClass.java:566)
    at java.io.ObjectStreamClass.createClassDesc(ObjectStreamClass.java:279)
    at java.io.ObjectStreamClass.lookupStreamClass(ObjectStreamClass.java:1087)
    at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:1055)
    at java.io.ObjectStreamClass.createClassDesc(ObjectStreamClass.java:268)
    at java.io.ObjectStreamClass.lookupStreamClass(ObjectStreamClass.java:1087)
    at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:1055)
    at java.io.ObjectStreamClass.createClassDesc(ObjectStreamClass.java:268)
    at java.io.ObjectStreamClass.lookupStreamClass(ObjectStreamClass.java:1087)
    at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:1055)
    at java.io.ObjectStreamClass.createClassDesc(ObjectStreamClass.java:268)
    at java.io.ObjectStreamClass.lookupStreamClass(ObjectStreamClass.java:1087)
    at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1554)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1497)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1461)
    at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:959)
    at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:360)
    at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1054)
    at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1384)
    at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1651)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1497)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1461)
    at android.os.Parcel.writeSerializable(Parcel.java:1389)
    at android.os.Parcel.writeValue(Parcel.java:1341)
    at android.os.Parcel.writeArrayMapInternal(Parcel.java:644)
    at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1313)
    at android.os.Bundle.writeToParcel(Bundle.java:1034)
    at android.os.Parcel.writeBundle(Parcel.java:669)
    at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:2919)
    at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3296)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5254)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
 Caused by: java.lang.ClassNotFoundException: Didn't find class "java.util.stream.Stream" on path: DexPathList[[zip file "/data/app/il.co.anykey.games.cardflip-2/base.apk"],nativeLibraryDirectories=[/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 libcore.reflect.InternalNames.getClass(InternalNames.java:53)
    at java.lang.Class.getDexCacheType(Class.java:479) 
    at java.lang.reflect.ArtMethod.getDexCacheType(ArtMethod.java:191) 
    at java.lang.reflect.ArtMethod.getReturnType(ArtMethod.java:145) 
    at java.lang.reflect.Method.getReturnType(Method.java:184) 
    at java.lang.Class.getDeclaredMethods(Class.java:771) 
    at java.io.ObjectStreamClass.computeSerialVersionUID(ObjectStreamClass.java:566) 
    at java.io.ObjectStreamClass.createClassDesc(ObjectStreamClass.java:279) 
    at java.io.ObjectStreamClass.lookupStreamClass(ObjectStreamClass.java:1087) 
    at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:1055) 
    at java.io.ObjectStreamClass.createClassDesc(ObjectStreamClass.java:268) 
    at java.io.ObjectStreamClass.lookupStreamClass(ObjectStreamClass.java:1087) 
    at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:1055) 
    at java.io.ObjectStreamClass.createClassDesc(ObjectStreamClass.java:268) 
    at java.io.ObjectStreamClass.lookupStreamClass(ObjectStreamClass.java:1087) 
    at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:1055) 
    at java.io.ObjectStreamClass.createClassDesc(ObjectStreamClass.java:268) 
    at java.io.ObjectStreamClass.lookupStreamClass(ObjectStreamClass.java:1087) 
    at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1554) 
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1497) 
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1461) 
    at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:959) 
    at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:360) 
    at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1054) 
    at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1384) 
    at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1651) 
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1497) 
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1461) 
    at android.os.Parcel.writeSerializable(Parcel.java:1389) 
    at android.os.Parcel.writeValue(Parcel.java:1341) 
    at android.os.Parcel.writeArrayMapInternal(Parcel.java:644) 
    at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1313) 
    at android.os.Bundle.writeToParcel(Bundle.java:1034) 
    at android.os.Parcel.writeBundle(Parcel.java:669) 
    at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:2919) 
    at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3296) 
    at android.os.Handler.handleCallback(Handler.java:739) 
    at android.os.Handler.dispatchMessage(Handler.java:95) 
    at android.os.Looper.loop(Looper.java:135) 
    at android.app.ActivityThread.main(ActivityThread.java:5254) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at java.lang.reflect.Method.invoke(Method.java:372) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
    Suppressed: java.lang.ClassNotFoundException: java.util.stream.Stream
    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)
            ... 45 more
 Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

1 个答案:

答案 0 :(得分:0)

documentationjava.util.stream要求API级别为24或更高。 Android 5.1.1是API 22,它没有java.util.stream.Stream类。