【发布时间】:2014-12-13 08:08:06
【问题描述】:
如果我在 runProguard=true 时在 android studio 中导出我的应用并将 APK 安装到真实设备,我的应用会停止并说:不幸的是 [yourapp] 已停止。
有什么问题? 我将 proguard-rules.txt 文件保留为默认状态:
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Applications/Android Studio.app/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
如果没有 Proguard,我的应用可以完美安装和运行。
【问题讨论】:
-
好吧,也许您正在使用库或 java 反射代码,proguard 有时会从您的代码中缩小.. 检查 proguard 站点以获取 android 的推荐设置.. 使用 -KeepClassmembers