“未知来源"在发布 apk [英] "Unknown Source" in release 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.
非常感谢任何指针=)
推荐答案
问题出在 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屋!