android 在加代码混淆时 ,搜集到的错误(一)

来源:互联网 发布:魔域登陆器源码 编辑:程序博客网 时间:2024/06/05 03:03

在混淆包含SlidingMenu, gson 的代码时,可能会报以下错误:

can't find superclass or interface com.google.android.maps.MapActivity

...

如果还使用到了gson来序列化或者反序列化json,程序还会抛出NullPointerException,这是因为代码被混淆后,成员变量以及getter、setter的名字都变了,这样就不能正常的序列化。

jni同理。

 需要添加  # Application classes that will be serialized/deserialized over Gson
 -keep class com.google.gson.examples.android.model.** { *; }

这样就解决了错误

0 0
原创粉丝点击