23

I have taken a fresh install of Eclipse and all the latest Android tools and want to use Proguard on existing project, but for now I have created a new blank one. I have added a proguard.cfg file to my project added proguard.config=proguard.cfg to my default.properties

Now when I try to export I get the following error

[2010-12-12 10:36:35 - ApplicationTest] Proguard returned with error code 1. See console
[2010-12-12 10:36:35 - ApplicationTest] 'C:\Program' is not recognized as an internal or external command,
[2010-12-12 10:36:35 - ApplicationTest] operable program or batch file.
[2010-12-12 10:36:35 - ApplicationTest] '-jar' is not recognized as an internal or external command,
[2010-12-12 10:36:35 - ApplicationTest] operable program or batch file.

I know it means there is a filepath setup incorrectly, question is where the heck is as I have looked through the general properties and project properties and can't see any reference to proguard or obfuscation so am stuck on what to change

Any help appreciated.

Pratik Butani
  • 60,504
  • 58
  • 273
  • 437
Chris
  • 629
  • 3
  • 8
  • 14

7 Answers7

29

You need to define your Android SDK path without spaces. Copy&Paste from this answer by Mark:

Proguard error: Expecting class path seperator - not sure where I need to put a path in quotes

Yep, that worked for me. To put it specifically:

In Eclipse: Window > Preferences > Android > SDK Location

use something like c:\Progra~1\android-sdk (or maybe c:\Progra~2\android-sdk on 64bit)

For me the path is "c:\Progra~1\Android\android-sdk-windows"

Community
  • 1
  • 1
Asmo Soinio
  • 1,182
  • 12
  • 12
9

According to comments posted by a Google Engineer in thread here: http://groups.google.com/group/android-developers/browse_thread/thread/19b96902fc20cede

*.bat file shipped with ProGuard doesn't support paths with spaces.

Having Java and Android SDK installed on paths without spaces doesn't solve the problem completely. Things can go wrong if path to eclipse workspace, temp folder or some of external JAR files contains spaces as well.

I was too lazy to re-install everything so my workaround involves making junction points on a file system.

Viktor Brešan
  • 5,293
  • 5
  • 33
  • 36
  • 3
    In case anyone comes to this question not knowing what junction points are, like I did, look into them because they made this way easier than trying to move eclipse and the sdk. If you have windows vista or beyond look into mklink. Junction points basically allow you to make a hard shortcut so you can link to the current directory location, but with a new name. For example: You can make a junction point folder called C:/Android/ link to your C:/Android Directory With Spaces In It/ Then you don't have to move anything. Thanks Viktor for the suggestion. – cottonBallPaws Feb 09 '11 at 18:36
  • Also, to save someone else time... You have to change your eclipse settings to use the new location for the sdk (Eclipse: Window > Preferences > Android > SDK Location) and change the location of your projects, which may mean removing them from the workspace and importing them back in with the new path. – cottonBallPaws Feb 09 '11 at 18:45
  • http://www.howtogeek.com/howto/windows-vista/using-symlinks-in-windows-vista/ - Great Tutorial – Matt Jan 26 '12 at 20:49
0

I changed the SDK paths to the 8.3 format and changed the proguard.jar folder in proguard.bat to the 8.3 format and now all is working again!

RoadXY
  • 447
  • 4
  • 10
0

I just reinstalled JAVA and ANDROID in the root directory instead of under their default paths in program files and it all worked

Chris
  • 629
  • 3
  • 8
  • 14
0

Is there not a way to specify the direct paths ourselves to the Java and Android SDK in the proguard config file?

Mimminito
  • 2,803
  • 3
  • 21
  • 27
0

This problem looks to be fixed in ADT 12. The following change in main_rules.xml solves the problem and should be included in ADT 12: https://review.source.android.com/#change,22791.

I can verify that downloading the fixed version and replacing the copy that comes with the sdk at your_sdk_path/tools/ant fixes this issue.

lillicoder
  • 552
  • 5
  • 9
0

OK , now i found one way to fix this problem 1, set up the "PROGUARD_HOME" EVN PATH to \tools\proguard 2, restart eclipse 3, now it work fine!

Hikmat Khan
  • 6,434
  • 2
  • 25
  • 22