26

I have a problem about Unable to access jarfile ..\lib\proguard.jar when run Export Singed Application Package from IntelliJ 11.1.

Environment:

  • Run proguard is success in Android SDK r16.
  • Run proguard is failed in Android SDK r17.

The problem is IntelliJ setting error or IntelliJ 11 bug?

JJD
  • 50,076
  • 60
  • 203
  • 339
德耀 李
  • 261
  • 1
  • 3
  • 3

5 Answers5

36

Edit $ANDROID_SDK\tools\proguard\bin\proguard.bat and set absolute path to PROGUARD_HOME

May look like this:

SET PROGUARD_HOME="c:\android-sdk\tools\proguard"
java -jar "%PROGUARD_HOME%"\lib\proguard.jar %*
exslim
  • 1,086
  • 9
  • 9
  • It works now thanks, I've up-marked your answer because it is clearly explained with the full SET command. Although please change to. SET PROGUARD_HOME= "%ANDROID_HOME%"\tools\proguard – 27k1 Jan 25 '17 at 08:42
20

This issue can also come up if you have a space anywhere in your Android SDK path. The solution is to modify $ANDROID_SDK\tools\proguard\bin\proguard.sh. Change this last line:

java -jar $PROGUARD_HOME/lib/proguard.jar "$@"

to

java -jar "$PROGUARD_HOME/lib/proguard.jar" "$@"
JJD
  • 50,076
  • 60
  • 203
  • 339
Phil Kulak
  • 6,960
  • 8
  • 45
  • 50
  • This is what solved my issue with the default Android Studio/ProGuard setup on OSX. – Jed May 31 '13 at 21:58
  • 1
    while you are at it, you should modify proguardgui.sh and retrace.sh in the same directory as well – Makibo Jun 07 '13 at 04:00
  • This worked, in my case when Android Studio installed, it installed as "Android Studio.app" (note the space) Now onto more ProGuard Hell, as it can't locate references. – CampbellGolf Jun 22 '13 at 16:02
  • now it says "Error: Unable to access jarfile $PROGUARD_HOME/lib/proguard.jar" . :( – android developer Mar 15 '14 at 22:05
  • 1+ I switched my eclipse from 32bit to 64bit ubuntu and faced the same issue. But the above resolved it. Thanks :) – Atul O Holic Jan 21 '15 at 07:59
17

On Mac:

/Applications/Android Studio.app/sdk/tools/proguard/bin/proguard.sh

Change this last line:

java -jar $PROGUARD_HOME/lib/proguard.jar "$@"

to

java -jar "$PROGUARD_HOME/lib/proguard.jar" "$@"
JJD
  • 50,076
  • 60
  • 203
  • 339
qinmiao
  • 5,559
  • 5
  • 36
  • 39
  • 1+ I switched my eclipse from 32bit to 64bit ubuntu and faced the same issue. But the above resolved it. Thanks :) – Atul O Holic Jan 21 '15 at 07:59
  • Please provide your input on this post also. http://stackoverflow.com/q/32783837/1503130 Struggling for a couple of hours now. – Prateek Sep 25 '15 at 14:20
3

The reason why it happened for me on my Windows machine was because I moved the location of the Android SDK in my file system but I didn't update my PROGUARD_HOME system variable. The PROGUARD_HOME system variable is referenced in the {android-sdk}\tools\proguard\bin\project.bat file.

Extra Info:

The value of my PROGUARD_HOME system variable was set as a path within my old Android SDK directory. I shouldn't experience this in future because I've now created an ANDROID_HOME system variable which points to my Android SDK and my PROGUARD_HOME system variable is now defined as follows:

%ANDROID_HOME%\tools\proguard

All I have to do in future if I relocate my Android SDK in future is update my ANDROID_HOME system variable.

Adil Hussain
  • 30,049
  • 21
  • 112
  • 147
  • Yes, seems like that's the solution, according to this issue being reported: https://code.google.com/p/android/issues/detail?id=66733 . here's an image showing what should be done: https://android.googlecode.com/issues/attachment?aid=667330015000&name=proguard.png&token=6OjT81-h9UWBgIjHxn-ofzfW_E8%3A1395411984200&inline=1 – android developer Mar 21 '14 at 14:27
1

This issue has been occurred after I had updated tools (26.6.2)+ migrating to win7 from xp.

The possible reason perhaps in proguard place because some folders can have a space in their path folders' names(like "Program Files",e.g.). In my case i did what has been pointed above but copied the entire proguard folder to new place (mine new became "c:\proguard") and put its path to PROGUARD_HOME

SET PROGUARD_HOME="c:\proguard"

in $ANDROID_SDK\tools\proguard\bin\proguard.bat file.


Another possible way: After tools upgrading i found very simple solution: find environment variable PROGARD_HOME on windows and edit its path to (in mine case ,currently) :

not  C:\Program Files\Android\android-sdk\tools\proguard 

but "C:\Program Files\Android\android-sdk\tools\proguard"

CodeToLife
  • 3,672
  • 2
  • 41
  • 29