2

我尝试应用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文件: 在此处输入图像描述

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

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

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

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
4

1 回答 1

2

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

-keep class * implements java.io.Serializable { *;}
-keepclassmembers class * implements java.io.Serializable { *;}
于 2015-04-13T12:12:31.533 回答