Xamarin proguard.ParseException: Unknown option '' in line 1 of file 'Properties/proguard.cfg'

前端 未结 2 627
面向向阳花
面向向阳花 2020-12-10 18:33

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 Proper

相关标签:
2条回答
  • 2020-12-10 19:01

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

    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'

    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

    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.

    EDIT:

    The proper link can be found here:

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

    0 讨论(0)
  • 2020-12-10 19:17

    The byte order mark can also be removed from the file with the following perl command :

    perl -e 's/\xef\xbb\xbf//;' -pi~ proguard.cfg 
    
    0 讨论(0)
提交回复
热议问题