10

I have just updated to Android SDK tools revision 12, immediately my application can't be exported with previous Proguard setting. I received the "Conversion to Dalvik format failed with error 1", the only library I use is "jcifs". I have tried cleaning and rebuilding, create a new project, and reassembling and I believe I have done almost anything I can read in the Internet. Is this a new bug from this new SDK? I suggest don't update for the time being if your project use Proguard.

UPDATE 1: I also tried to export a simple Hello application with proguard set, still the same message. It looks like something is broken with this version of SDK tool.

UPDATE 2: I have to delete the whole tools folder in SDK directory and copy a backup of SDK tools revision 11 into it. At least I can go back to work and export with proguard works again. I hope this information helps whoever in the same situation. I still have no idea what is going on though, hope someone can shed a light on this annoying issue.

UPDATE 3: I have reported this issue as a bug here: http://code.google.com/p/android/issues/detail?id=18359 hope someone takes a good look at the issue, until then you will be advised to stay out of this version if you are using Proguard in your development.

Yongki
  • 151
  • 1
  • 1
  • 9

8 Answers8

26

The problem is caused by ProGuard command line in R12 in the file [Android SDK Installation Directory]\tools\proguard\bin\proguard.bat. Simply edit the following line will solve the problem.

Change

call %java_exe% -jar "%PROGUARD_HOME%"\lib\proguard.jar %*

to

call %java_exe% -jar "%PROGUARD_HOME%"\lib\proguard.jar %1 %2 %3 %4 %5 %6 %7 %8 %9
Alan
  • 608
  • 6
  • 14
  • I can confirm that this change does fix the problem. – Yongki Jul 11 '11 at 15:23
  • If it doesn't work, setup the environment variable (PROGUARD_HOME) manually in "Advanced System Settings" for your computer/user. In my case, my path had a space but it was working in R11. – Ernest Laurentin Jul 19 '11 at 07:58
  • Thank you! I have had this problem for a while... – pqn Jul 28 '11 at 18:05
  • I'm surprised that this broke... :( But your change works... Thanks! – Jona Aug 09 '11 at 19:38
  • Thank you so much!!! This actually does work and AT LAST solved the problem for me... No idea WTF this answer is not marked as accepted :( – EvilDuck Aug 20 '11 at 19:52
  • Just changing the batch files didn't seem to work for me, but updating to Proguard 4.6 (AND changing the batch files) did. – Sven Viking Aug 26 '11 at 17:43
  • How have they not fixed this yet!?!? I'm now on another machine adjusting this months later. – Anthony Sep 15 '11 at 14:10
3

I downloaded Proguard 4.6 and copied the contents of /lib and /bin into /tools/proguard/ which fixed the problem.

Michiel
  • 270
  • 1
  • 3
  • 11
  • This is the proper way to resolve this issue. CLeaning, reverting to an earlier sdk, etc. are all incorrect (the may work for some in certain cases, but the proper way to resolve this issue is to download Proguard 4.6 as stated by Michiel) – Lysogen Sep 30 '11 at 15:05
2

The only solution i've found to this problem is to change, in proguard.cfg

-optimizationpasses 5

to

-optimizationpasses 2

Jakob Eriksson
  • 18,597
  • 1
  • 25
  • 34
2

I encountered the same issue with Android SDK Tools Rev 16 attempting to export a signed application package from Helios Eclipse 3.6 on Mac OS X 10.7.2 for execution on a Samsung Galaxy Nexus 4.0.2 build ICL53F

Problem:

[2012-01-11 03:15:46 - Chapter 8 Where Am I] Proguard returned with error code 1. See console
[2012-01-11 03:15:46 - Chapter 8 Where Am I] proguard.ParseException: Unknown option '8' in argument number 9
[2012-01-11 03:15:46 - Chapter 8 Where Am I]    at proguard.ConfigurationParser.parse(ConfigurationParser.java:170)
[2012-01-11 03:15:46 - Chapter 8 Where Am I]    at proguard.ProGuard.main(ProGuard.java:491)

Solution:

cd /Applications/android-sdk-mac_x86/tools/proguard/bin

then modify file proguard.sh as follows:

# java -jar "$PROGUARD_HOME"/lib/proguard.jar "$@"
java -jar "$PROGUARD_HOME"/lib/proguard.jar "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8"
kapex
  • 28,903
  • 6
  • 107
  • 121
0

I just fixed this issue by downloading the the R11 installer from http://dl.google.com/android/installer_r11-windows.exe and replacing the \tools directory with this one:
Run the downloaded installer.
Specify a different destination folder than the regular install and click through to Install.
At then end you can uncheck "Start SDK Manager...", and click [Finish].
The installer will create a \tools directory in that different folder.
Rename your regular "\android-sdk-windows\tools" directory, and copy that \tools directory to your regular "\android-sdk-windows\" directory.
The project should now build without the "Error 1".
I haven't looked into what is different in the 2 directories yet.

TheTall
  • 298
  • 3
  • 7
  • I have the same problem and I can confirm that I don't get the error by replacing the R12 Proguard folder with the R11 one. – BrainCrash Jul 10 '11 at 11:46
  • Simply overwriting proguard folder solved the problem but it somehow causes the emulator to crash with message: "PANIC: Missing arch-specific emulator program: C:\Android_Devs\android-sdk-windows-1.5_r3\tools/emulator-arm.exe" – Yongki Jul 10 '11 at 18:39
0

Changing proguard.bat as suggested didn't help in my case. Upgrading to proguard 4.6 also didn't help. What helped me is that I had to downgrade to Android SDK tools to revision 11. Note: when running SDK Manager and installing packages, I didn't install package "Android SDK Tools, revision 12".

UPDATE:

I have tried with Android SDK revision 15, but the issue is still present. Now this workaround of downgrading to revision 11 does not work any more, as URL that SDK Manager is using to download packages is not working any more.

After 2 days of trying different solutions, upgrading to proguard 4.6 did help.

ssasa
  • 1,616
  • 1
  • 18
  • 30
0

Android SDK Tools Rev 16 ships with ProGuard 4.4 which has this problem. I upgraded to 4.7 by replacing the files in the android-sdk\tools\proguard folder and that fixed the problem for me.

Thanks

Nikhil
  • 16,194
  • 20
  • 64
  • 81
0

It worked for me. As suggested by Michiel i replaced the proguard.bat from proguard 4.6 and now i am able to export the signed application without the error. Thanks mate.

vinod
  • 558
  • 5
  • 10