“未知来源"在发行版APK [英] "Unknown Source" in release apk

查看:125
本文介绍了“未知来源"在发行版APK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的调试APK中的所有内容都可以正常运行.但是,当我导出并安装APK时,一切正常,直到我调用引用的库为止.

Everything in my debug APK works just fine. However, when I export my APK and install it, everything works fine until I make a call to a referenced library.

E/AndroidRuntime(32571):    at com.znood.znoodapp.ShowResultsActivity.a (Unknown Source)

我正在使用ProGuard.

I am using ProGuard.

我的库位于libs目录中,并已添加到构建路径中.

My libraries are in the libs directory and are added to build path.

任何指针都受到高度赞赏=)

Any pointers are highly appreciated =)

推荐答案

问题出在Google Gson库. Proguard将类名转换为混淆的类名,从而使json转换错误.

The problem was with the Google Gson library. Proguard converts class names into obfuscated ones rendering json conversion buggy.

为了解决此问题,请确保proguard-project.txt中包含以下内容

In order to solve this problem, make sure to have the following in your proguard-project.txt

# the classes that you use for Gson conversion
-keep class com.yourapp.objects.** { *; }

# without this line, I was having ClassCastException
-keepattributes Signature, *Annotation*

我希望这对某人有帮助=)

I hope this helps someone =)

这篇关于“未知来源"在发行版APK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆