问题描述
我的调试APK中的一切都很好.但是,当我导出APK并安装它时,一切正常工作,直到我打电话给引用的库.
E/AndroidRuntime(32571): at com.znood.znoodapp.ShowResultsActivity.a (Unknown Source)
我使用proguard.
我的图书馆位于libs目录中,并添加到构建路径.
任何指针都非常感谢=)
推荐答案
问题在于google gson库. Proguard将类名转换为渲染JSON转换错误的混淆.
为了解决这个问题,请务必在您的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*
我希望这有助于某人=)
其他推荐答案
如果您尚未在proguard-project.txt中定义库,则可以添加如此
-libraryjars/libs/smack.jar
-libraryjars/llibs/libphonenumber-5.0v1.5.jar
问题描述
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)
I am using ProGuard.
My libraries are in the libs directory and are added to build path.
Any pointers are highly appreciated =)
推荐答案
The problem was with the Google Gson library. Proguard converts class names into obfuscated ones rendering json conversion buggy.
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 =)
其他推荐答案
If you haven't defined your libraries in proguard-project.txt then you can add like this
-libraryjars /libs/smack.jar
-libraryjars /libs/libphonenumber-5.0v1.5.jar
Android obfuscate app using proguard keeps obfuscating library jars - or is it?