Wednesday, July 5, 2017

Visual Studio 2017 Xamarin Android API Level 25: Enable the default proguard

Leave a Comment

I cannot build my android application with the default visual studio 2017 proguard enabled.

I enable the proguard from

Project > Android.Properties > Android Options > Check "Enable ProGuard"

Then I cannot build my application.

It says:

C:\Program Files (Access is denied)

How do I fix this?

3 Answers

Answers 1

This was a bug in xamarin.
happens if the android sdk path contains space ("C:\Program Files (x86)\Android\android-sdk"). You have to move the android-sdk to a path without spaces.(C:\android-sdk)
See here how.

This was reportedly fixed so upgrading Xamarin should fix the bug however note that some devs reported as of 2017-06-22 that this was still reproducable using:

Xamarin 4.6.0.267 (750994b)
Xamarin.Android SDK 7.4.0.9 (5f3167a)

So if the updating all the tools and sdk does not work you will have to move the directory as described above.

Answers 2

Try the following I had a similar issue and work for me: -dontwarn okio.** -dontwarn java.nio.** -dontwarn java.lang.invoke.** The conversation about the same issue was continued here with other solutions: https://forums.xamarin.com/discussion/45210/enable-proguard-error-c-program-files-access-is-denied

Answers 3

you might have to set ANDROID_HOME (the path to the Android SDK, without spaces) under "System Properties" > "Advanced System Settings" > "Environment Variables" > "System Variables". Visual Studio should pick up these values - also check permissions on proguard.exe, eg. if the current user can run it from the command line. here it's also explained: "How to Fix Error “C:\Program Files (Access is Denied)” When Proguard has Enabled while Build a Android app" (linking the SDK is the other option). Simply moving the whole SDK to C:\Android might be suggested.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment