Xamarin proguard.ParseException:文件'Properties/proguard.cfg'的第1行中的未知选项'' [英] Xamarin proguard.ParseException: Unknown option '' in line 1 of file 'Properties/proguard.cfg'

查看:77
本文介绍了Xamarin proguard.ParseException:文件'Properties/proguard.cfg'的第1行中的未知选项''的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Proguard与Xamarin一起使用. 因此,我在项目选项中将其启用(选中了Enable ProGuard),然后在属性中创建了文件proguard.cfg(作为新的文本文件,对吗?) 并检查BuildAction-> ProguardConfiguration

I'm trying to use proguard with Xamarin. So I enabled it in project options (checked Enable ProGuard), and I created a file proguard.cfg in Properties, (as new Text file, is it right?) and checked the BuildAction -> ProguardConfiguration

proguard文件仅包含-keep配置,并带有注释.无论我留下还是删除评论,我总是在第1行出现解析错误:

The proguard file contains only a -keep configuration, with a comment. Whether I leave or remove the comment, I always get a parse error on line 1 :

# test comment 
-keep class !android.support.v7.view.menu.**, !android.support.design.internal.NavigationMenu, !android.support.design.internal.NavigationMenuPresenter, !android.support.design.internal.NavigationSubMenu, android.support.** {*;}

我收到Unknown option '' in line 1错误.

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: 错误:工具退出,代码为:1.输出:proguard.ParseException: 文件'Properties/proguard.cfg'的第1行中的未知选项''
包含在参数10中 proguard.ConfigurationParser.parse(ConfigurationParser.java:191)在 proguard.ProGuard.main(ProGuard.java:484)(WheezMe.Droid)

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: Error: Tool exited with code: 1. Output: proguard.ParseException: Unknown option '' in line 1 of file 'Properties/proguard.cfg'
included from argument number 10 at proguard.ConfigurationParser.parse(ConfigurationParser.java:191) at proguard.ProGuard.main(ProGuard.java:484) (WheezMe.Droid)

有什么主意吗?

推荐答案

我在文档的这一部分中添加了一段时间,提到您需要删除BOM(字节顺序标记):

I added this section of the docs awhile back to mention that you need to remove the BOM(Byte order mark):

注意::如果收到类似以下的错误,则说明配置文件包含ProGuard工具无法处理的字节顺序标记(BOM):

Note: If you get an error like the following, then your configuration file contains a byte order mark (BOM), which the ProGuard tool cannot handle:

Unknown option '-keep' in line 1 of file 'proguard.cfg'

为避免此问题,请从文本编辑器中保存您的自定义配置文件,该文件允许您省略BOM.例如,如果要从Notepad ++保存,则可以使用编码>在没有BOM的UTF-8中编码"选项来保存没有BOM的ProGuard配置文件.

To prevent this problem, save your custom configuration file from a text editor that allows you to omit the BOM. For example, if you are saving from Notepad++, you can use the Encoding > Encode in UTF-8 Without BOM option to save your ProGuard configuration file without BOM.

https://developer.xamarin .com/guides/android/deployment,_testing,_and_metrics/publishing_an_application/part_1 _-_ preparing_an_application_for_release/#ProGuard

总的来说,您可以使用任何想要删除BOM的方法. Notepad ++使其非常简单.在此处添加完整的解决方案,以帮助其他人获得可见性.

By all means you can use whatever method you'd like to remove the BOM. Notepad++ makes it pretty simple. Adding the full solution here to help others for visibility.

正确的链接可以在这里找到:

The proper link can be found here:

https://developer.xamarin.com/guides/android/deployment,_testing,_and_metrics/proguard/#File_Issues

这篇关于Xamarin proguard.ParseException:文件'Properties/proguard.cfg'的第1行中的未知选项''的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆