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 Manager,并注意菜单选项下左上角的路径.在我的情况下,这是C:\ Users \ Sahar \ AppData \ Local \ Android \ android-sdk. proguard文件夹位于该路径的工具文件夹中(在我的情况下为C:\ Users \ Sahar \ AppData \ Local \ Android \ android-sdk \ tools \ proguard).
- 关闭所有可能正在访问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:\Users\Sahar\AppData\Local\Android\android-sdk. The proguard folder is located in the tools folder of this path (in my case this was C:\Users\Sahar\AppData\Local\Android\android-sdk\tools\proguard).
- 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屋!
查看全文