Xamarin Android ProGuard 启用 [英] Xamarin Android ProGuard Enable
本文介绍了Xamarin Android ProGuard 启用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发 xamarin 应用程序.当我在 android 属性中启用ProGuard"时,在构建应用程序时,我收到以下错误:
i am working on xamarin application. When i enable "ProGuard" in android properties, while building the application, I'm getting the following error:
"java.exe" exited with code1.
proguard cfg 文件有以下内容:
proguard cfg file has the following:
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
开发环境:
Visual Studio 2015
Xamarin 4.0.4.4
Developing Environment:
Visual Studio 2015
Xamarin 4.0.4.4
推荐答案
我在启用 ProGuard 时遇到了同样的问题.按照关于此链接的建议,我通过更新我的 proguard 解决了这个问题手动.这些步骤相当容易遵循,他们解决了问题.希望这对您有所帮助.
I had the same issue when enabling ProGuard. By following the advice on this link, I fixed the issue by updating my proguard manually. The steps are fairly easy to follow and they fixed the problem. Hope this helps you.
- 从以下位置下载 ProGuard zip 文件:https://sourceforge.net/projects/proguard/files/.在撰写本文时,ProGuard 的最新版本是 5.3.
- ProGuard 没有安装程序,因此您需要解压缩文件并将 proguard 文件夹结构复制到以下步骤中指定的位置.
- 启动 SDK 管理器并注意左上角菜单选项下的路径.就我而言,这是 C:UsersSaharAppDataLocalAndroidandroid-sdk.proguard 文件夹位于此路径的工具文件夹中(在我的例子中是 C:UsersSaharAppDataLocalAndroidandroid-sdk oolsproguard).
- 关闭所有可能访问 SDK 的开发环境,并将 proguard 文件夹重命名为 proguard.old.
- 将新版本的 proguard 文件夹复制到 tools 文件夹中,并在必要时将其重命名为 proguard(在我的情况下,复制的文件夹是从 proguard5.3 重命名的).
- 最后将配置文件从 proguard.old 文件夹复制到新文件夹中.就我而言,这些是:-proguard-android.txt、proguard-android-optimize.txt 和 proguard-project.txt.
- 在启用 ProGuard 的情况下清理和重建您的项目.
- Download the ProGuard zip file available from: https://sourceforge.net/projects/proguard/files/. At time of writing the latest version of ProGuard was 5.3.
- ProGuard does not have a setup program, so you will need to unzip the file and copy the proguard folder structure into the location identified in the steps below.
- Launch the SDK Manager and note the path in the top left under the menu options. In my case this was C:UsersSaharAppDataLocalAndroidandroid-sdk. The proguard folder is located in the tools folder of this path (in my case this was C:UsersSaharAppDataLocalAndroidandroid-sdk oolsproguard).
- Close any development environments that might be accessing the SDK and rename the proguard folder to proguard.old.
- Copy the proguard folder of the new version into the tools folder and rename it to proguard if necessary (in my case the copied folder was renamed from proguard5.3).
- Finally copy the configuration files from the proguard.old folder to the new folder. In my case these were:- proguard-android.txt, proguard-android-optimize.txt and proguard-project.txt.
- Clean and rebuild your project with ProGuard enabled.
这篇关于Xamarin Android ProGuard 启用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文