When I was trying to build one of my android apps in “Release” mode to deploy, I got and Error that “C:\Program Files (Access is Denied)” and the File was “PROGUARD”.
Then I looked for a solution to avoid the error.
The Reason For The Error
In the Android project, I have set the Proguard Enabled before I build the app.
The reason for the error is there is a space in the path to the PROGUARD. Proguard is in the Android folder in Program Files (x86) and there is a spaces between “Program Files (x86)”.
C:\Program Files (x86)\Android\android-sdk\tools\proguard
So PROGUARD may unable to find the path..
So How to Fix This ?
What we have to do is Place the android-sdk folder to a path without spaces..
To do that I created a symbolic Link(sym-link) ..
Here are steps to create a symbolic link..
1 .First we have to download and Install the Link Shell Extension.
2. After Installed the Extension then we are ready to create the sym-link.
Here are steps How I created according to my Folder structure..
First I create a Folder in C: drive outside of Program Files x86 which is “AndroidSysLink”. So we have to Link the Android-SDK path to this folder.
First Go to Program Files x86 and Right Click on Android Folder and we can see a new context menu “Pick Link Source”. Then Click it..
Then Go back and Select “AndroidSysLink” Folder -> Right Click . Then We can see a new context menu “Drop As” . When we click on it and we will see few options in another context menu. Then Select “Junction”. And then The link will be created.
3. Then We have to change the Android SDK path in Visual Studio.
So go to Tools -> Options -> Xamarin and Click the “change” button inside of the Android SDK location…
Then we can see a dialogue to select the sdk path..
4. Go to the Linked folder and copy the path in it..
5. Paste the Path in the sdk-path selection dialogue box.
Then Click OK…
6. Now The Path has changed an Click OK to conform the new SDK path..
7. Now we are ready to release the app. But before Build the app recheck the configuration in properties.
First Verify Target Android versions..
Make Sure the Confutation has set to “Release” and Proguard is Enabled..
8. Then Build The app in Release Mode..
The app will build successfully..
9. Now we are ready to Archive the Android App.
Right Click on the Android project and click “Archive“…
We can see Archiving Progress…
We can see a Settings I con with a Green icon when the app has archived successfully and in the bottom of the dialogue we can see build information.
Click the “Open” folder and the created .apk file will see in that folder.