gpt4 book ai didi

android - splitdexfile 导致崩溃 : Facebook SDK Parcelable encounteredClassNotFoundException reading a Serializable object

转载 作者:行者123 更新时间:2023-11-29 00:12:03 33 4
gpt4 key购买 nike

我尝试应用 splitdexfile 选项将 Facebook 的 sdk 拆分为单独的 dex 文件。

到目前为止我做了什么:

1) 我在我的 dexguard-project.txt 文件中添加了以下行:

-splitdexfile com.facebook.**

2) 在我的 project.properties 文件的下面一行:

proguard.config=dexguard-project.txt

3) 我已经使用Export Optimized and Obfuscated Application Package... (DexGuard) 选项成功导出了一个已签名的 apk。

4) 我检查并确认 apk 被拆分为 2 个 dex 文件: enter image description here

然后我把apk安装到一个设备上,然后尝试facebook connect并得到了;

java.lang.RuntimeException: Parcelable encounteredClassNotFoundException reading a Serializable object (name = o.?$?)

我在生成的 mapping.txt 文件中找不到 o.?$? 类。

DexGuard 版本:6.1

Facebook SDK 版本:3.22.0

完整的堆栈跟踪:

04-10 10:12:55.727: E/ActivityThread(15362): Failed to find provider info for com.facebook.katana.provider.AttributionIdProvider
04-10 10:12:58.039: E/AndroidRuntime(15362): FATAL EXCEPTION: main
04-10 10:12:58.039: E/AndroidRuntime(15362): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.devrim/com.facebook.LoginActivity}: java.lang.RuntimeException: Parcelable encounteredClassNotFoundException reading a Serializable object (name = o.?$?)
04-10 10:12:58.039: E/AndroidRuntime(15362): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
04-10 10:12:58.039: E/AndroidRuntime(15362): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
04-10 10:12:58.039: E/AndroidRuntime(15362): at android.app.ActivityThread.access$600(ActivityThread.java:141)
04-10 10:12:58.039: E/AndroidRuntime(15362): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
04-10 10:12:58.039: E/AndroidRuntime(15362): at android.os.Handler.dispatchMessage(Handler.java:99)
04-10 10:12:58.039: E/AndroidRuntime(15362): at android.os.Looper.loop(Looper.java:137)
04-10 10:12:58.039: E/AndroidRuntime(15362): at android.app.ActivityThread.main(ActivityThread.java:5103)
04-10 10:12:58.039: E/AndroidRuntime(15362): at java.lang.reflect.Method.invokeNative(Native Method)
04-10 10:12:58.039: E/AndroidRuntime(15362): at java.lang.reflect.Method.invoke(Method.java:525)
04-10 10:12:58.039: E/AndroidRuntime(15362): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
04-10 10:12:58.039: E/AndroidRuntime(15362): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
04-10 10:12:58.039: E/AndroidRuntime(15362): at dalvik.system.NativeStart.main(Native Method)
04-10 10:12:58.039: E/AndroidRuntime(15362): Caused by: java.lang.RuntimeException: Parcelable encounteredClassNotFoundException reading a Serializable object (name = o.?$?)
04-10 10:12:58.039: E/AndroidRuntime(15362): at android.os.Parcel.readSerializable(Parcel.java:2177)
04-10 10:12:58.039: E/AndroidRuntime(15362): at android.os.Parcel.readValue(Parcel.java:2022)
04-10 10:12:58.039: E/AndroidRuntime(15362): at android.os.Parcel.readMapInternal(Parcel.java:2255)
04-10 10:12:58.039: E/AndroidRuntime(15362): at android.os.Bundle.unparcel(Bundle.java:223)
04-10 10:12:58.039: E/AndroidRuntime(15362): at android.os.Bundle.getSerializable(Bundle.java:1259)
04-10 10:12:58.039: E/AndroidRuntime(15362): at android.content.Intent.getSerializableExtra(Intent.java:4543)
04-10 10:12:58.039: E/AndroidRuntime(15362): at com.facebook.LoginActivity.onCreate(SourceFile:65)
04-10 10:12:58.039: E/AndroidRuntime(15362): at android.app.Activity.performCreate(Activity.java:5133)
04-10 10:12:58.039: E/AndroidRuntime(15362): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-10 10:12:58.039: E/AndroidRuntime(15362): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
04-10 10:12:58.039: E/AndroidRuntime(15362): ... 11 more
04-10 10:12:58.039: E/AndroidRuntime(15362): Caused by: java.lang.ClassNotFoundException: o.?$?
04-10 10:12:58.039: E/AndroidRuntime(15362): at java.lang.Class.classForName(Native Method)
04-10 10:12:58.039: E/AndroidRuntime(15362): at java.lang.Class.forName(Class.java:204)
04-10 10:12:58.039: E/AndroidRuntime(15362): at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:2304)
04-10 10:12:58.039: E/AndroidRuntime(15362): at java.io.ObjectInputStream.readNewClassDesc(ObjectInputStream.java:1663)
04-10 10:12:58.039: E/AndroidRuntime(15362): at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:683)
04-10 10:12:58.039: E/AndroidRuntime(15362): at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:1806)
04-10 10:12:58.039: E/AndroidRuntime(15362): at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:787)
04-10 10:12:58.039: E/AndroidRuntime(15362): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2006)
04-10 10:12:58.039: E/AndroidRuntime(15362): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1963)
04-10 10:12:58.039: E/AndroidRuntime(15362): at android.os.Parcel.readSerializable(Parcel.java:2171)
04-10 10:12:58.039: E/AndroidRuntime(15362): ... 20 more
04-10 10:12:58.039: E/AndroidRuntime(15362): Caused by: java.lang.NoClassDefFoundError: o/?$?
04-10 10:12:58.039: E/AndroidRuntime(15362): ... 30 more
04-10 10:12:58.039: E/AndroidRuntime(15362): Caused by: java.lang.ClassNotFoundException: Didn't find class "o.?$?" on path: DexPathList[[zip file "/data/app/com.devrim-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.devrim-1, /vendor/lib, /system/lib]]
04-10 10:12:58.039: E/AndroidRuntime(15362): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
04-10 10:12:58.039: E/AndroidRuntime(15362): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
04-10 10:12:58.039: E/AndroidRuntime(15362): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
04-10 10:12:58.039: E/AndroidRuntime(15362): ... 30 more

最佳答案

这可以通过在 dexguard-project.txt 文件中添加以下行来解决:

-keep class * implements java.io.Serializable { *;}
-keepclassmembers class * implements java.io.Serializable { *;}

关于android - splitdexfile 导致崩溃 : Facebook SDK Parcelable encounteredClassNotFoundException reading a Serializable object,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29556761/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com