0

問題: 2 つのアプリを持っています。ブロードキャストを介して相互にやり取りします。Androidライブラリにパーセル可能なクラスがあります(ライブラリにクラスのコンテンツを送信します)。したがって、Proguard を使用した後、ClassNotFondException が発生しました。それを解決する方法は?

07-03 02:13:51.832: E/AndroidRuntime(6801): FATAL EXCEPTION: main

07-03 02:13:51.832: E/AndroidRuntime(6801): java.lang.RuntimeException: Unable to start receiver <appname>.<name>.ar.free.BRMain: java.lang.RuntimeException: Parcelable encounteredClassNotFoundException reading a Serializable object (name = <appname>.a.a.b)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at android.app.ActivityThread.handleReceiver(ActivityThread.java:2277)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at android.app.ActivityThread.access$1500(ActivityThread.java:140)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at android.os.Handler.dispatchMessage(Handler.java:99)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at android.os.Looper.loop(Looper.java:137)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at android.app.ActivityThread.main(ActivityThread.java:4898)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at java.lang.reflect.Method.invokeNative(Native Method)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at java.lang.reflect.Method.invoke(Method.java:511)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at dalvik.system.NativeStart.main(Native Method)

07-03 02:13:51.832: E/AndroidRuntime(6801): Caused by: java.lang.RuntimeException: Parcelable encounteredClassNotFoundException reading a Serializable object (name = <appname>.a.a.b)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at android.os.Parcel.readSerializable(Parcel.java:2148)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at android.os.Parcel.readValue(Parcel.java:2016)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at android.os.Parcel.readMapInternal(Parcel.java:2226)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at android.os.Bundle.unparcel(Bundle.java:223)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at android.os.Bundle.getInt(Bundle.java:922)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at <appname>.<name>.ar.free.BRMain.onReceive(BRMain.java:35)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at android.app.ActivityThread.handleReceiver(ActivityThread.java:2270)

07-03 02:13:51.832: E/AndroidRuntime(6801):     ... 10 more

07-03 02:13:51.832: E/AndroidRuntime(6801): Caused by: java.lang.ClassNotFoundException: <appname>.a.a.b

07-03 02:13:51.832: E/AndroidRuntime(6801):     at java.lang.Class.classForName(Native Method)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at java.lang.Class.forName(Class.java:217)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:2301)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at java.io.ObjectInputStream.readNewClassDesc(ObjectInputStream.java:1660)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:683)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:1803)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:787)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2003)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1960)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at android.os.Parcel.readSerializable(Parcel.java:2142)

07-03 02:13:51.832: E/AndroidRuntime(6801):     ... 16 more

07-03 02:13:51.832: E/AndroidRuntime(6801): Caused by: java.lang.NoClassDefFoundError: <appname>/a/a/b

07-03 02:13:51.832: E/AndroidRuntime(6801):     ... 26 more

07-03 02:13:51.832: E/AndroidRuntime(6801): Caused by: java.lang.ClassNotFoundException: <appname>.a.a.b

07-03 02:13:51.832: E/AndroidRuntime(6801):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)

07-03 02:13:51.832: E/AndroidRuntime(6801):     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)

07-03 02:13:51.832: E/AndroidRuntime(6801):     ... 26 more
4

1 に答える 1

1

Parcelableクラスをproguard-project.txtファイルに追加してから、プロジェクトで proguard を再度実行する必要があります。

たとえば、次のようなものをファイルに追加して、もちろんクラスのproguard-project.txt完全修飾名を置き換えます。

-keep public class com.example.MyParcelableClass
于 2013-07-02T23:50:59.947 に答える