尝试打开应用选择器以显示PDF时,我的应用崩溃。崩溃似乎在应用程序依赖库中定义的类中。奇怪的是,类 T4PushAuthentication 显然与调用无关。它仍然是呼叫活动的成员 这是导致崩溃的代码片段:
Intent target = new Intent(Intent.ACTION_VIEW);
Uri fileUri = T4IDAppFileProvider.getUriForFile(activity, activity.getApplicationContext().getPackageName() + ".utils.provider", file);
target.setDataAndType( fileUri, T4Keys.APPLICATION_PDF);
target.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
Intent chooserIntent = Intent.createChooser(target, "Open File");
chooserIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
activity.startActivity(chooserIntent);
执行最后一行代码时发生崩溃。
这是我得到的堆栈跟踪:
02-12 11:19:34.154 9506-9506/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: android:ui, PID: 9506
java.lang.RuntimeException: Unable to start activity ComponentInfo{android/com.android.internal.app.ChooserActivity}: java.lang.RuntimeException: Parcelable encountered ClassNotFoundException reading a Serializable object (name = com.intesigroup.time4eid.sdk.v2.models.T4PushAuthentication)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2572)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5728)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
Caused by: java.lang.RuntimeException: Parcelable encountered ClassNotFoundException reading a Serializable object (name = com.intesigroup.time4eid.sdk.v2.models.T4PushAuthentication)
at android.os.Parcel.readSerializable(Parcel.java:2491)
at android.os.Parcel.readValue(Parcel.java:2294)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2592)
at android.os.BaseBundle.unparcel(BaseBundle.java:221)
at android.os.Bundle.getParcelable(Bundle.java:786)
at android.content.Intent.getParcelableExtra(Intent.java:5575)
at com.android.internal.app.ChooserActivity.onCreate(ChooserActivity.java:132)
at android.app.Activity.performCreate(Activity.java:6314)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2519)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5728)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
Caused by: java.lang.ClassNotFoundException: com.intesigroup.time4eid.sdk.v2.models.T4PushAuthentication
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at android.os.Parcel$2.resolveClass(Parcel.java:2477)
at java.io.ObjectInputStream.readNewClassDesc(ObjectInputStream.java:1641)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:657)
at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:1782)
at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:761)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1983)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1940)
at android.os.Parcel.readSerializable(Parcel.java:2485)
at android.os.Parcel.readValue(Parcel.java:2294)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2592)
at android.os.BaseBundle.unparcel(BaseBundle.java:221)
at android.os.Bundle.getParcelable(Bundle.java:786)
at android.content.Intent.getParcelableExtra(Intent.java:5575)
at com.android.internal.app.ChooserActivity.onCreate(ChooserActivity.java:132)
at android.app.Activity.performCreate(Activity.java:6314)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2519)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5728)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.intesigroup.time4eid.sdk.v2.models.T4PushAuthentication" on path: DexPathList[[directory "."],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 java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at android.os.Parcel$2.resolveClass(Parcel.java:2477)
at java.io.ObjectInputStream.readNewClassDesc(ObjectInputStream.java:1641)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:657)
at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:1782)
at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:761)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1983)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1940)
at android.os.Parcel.readSerializable(Parcel.java:2485)
at android.os.Parcel.readValue(Parcel.java:2294)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2592)
at android.os.BaseBundle.unparcel(BaseBundle.java:221)
at android.os.Bundle.getParcelable(Bundle.java:786)
at android.content.Intent.getParcelableExtra(Intent.java:5575)
at com.android.internal.app.ChooserActivity.onCreate(ChooserActivity.java:132)
at android.app.Activity.performCreate(Activity.java:6314)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2519)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5728)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
Suppressed: java.lang.ClassNotFoundException: com.intesigroup.time4eid.sdk.v2.models.T4PushAuthentication
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)
... 29 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
编辑:问题似乎是调用活动中的T4PushAuthentication成员类。看起来被调用者序列化了该成员,并且在尝试对其进行反序列化时找不到该类信息。我如何提供此类信息?我想念什么吗?
答案 0 :(得分:0)
我发现了这个错误,实际上是在活动类本身中:它在startActivity成员中有一个重载,该成员将T4PushAuthentication对象包装到了intent中:(