Android ==> ant and proguard?
Asked Answered
M

2

2

I am getting the following error while obfuscating my application. How can i define the output jar in my build.xml?

 [java] Shrinking...
 [java] java.io.IOException: The output jar is empty. Did you specify the proper '-keep' options?
 [java]     at proguard.shrink.Shrinker.execute(Shrinker.java:148)
 [java]     at proguard.ProGuard.shrink(ProGuard.java:294)
 [java]     at proguard.ProGuard.execute(ProGuard.java:100)
 [java]     at proguard.ProGuard.main(ProGuard.java:499)
Marieann answered 3/8, 2010 at 19:51 Comment(0)
K
3

The tutorial here has never gone wrong for me.

Killjoy answered 13/8, 2010 at 17:55 Comment(2)
I have tried it, it doesn't work: BUILD FAILED /Users/aryan/Desktop/MyApp/build.xml:49: taskdef class com.android.ant.SetupTask cannot be foundMarieann
thanks, i finally figured out what the problem was. I specified the sdk location manually instead of reading from local.properties <property name="sdk.dir" value="/Platforms/android.platform" />Marieann
R
8
  1. Use Android SDK Tools revision 8 or later
  2. If you do not have build.xml for your project, run command like this in some empty directory android create project --name <Your Project Name> --package <Your Company Name> --target 7 --path . --activity dummy Find build.xml which you can copy to root directory of the project.
  3. In default.properties add reference to proguard settings (proguard.config=proguard.cfg)
  4. Turn off android:debuggable in application manifest.
  5. Run 'ant release' command

You should find directory called ./bin/proguard and ./bin/-release.apk. You can find more details here.

Recent answered 14/2, 2011 at 14:40 Comment(1)
I'm going to reiterate your point #4 "Turn off android:debuggable in application manifest." ProGuard does not run at all if debuggable is true!!Knighton
K
3

The tutorial here has never gone wrong for me.

Killjoy answered 13/8, 2010 at 17:55 Comment(2)
I have tried it, it doesn't work: BUILD FAILED /Users/aryan/Desktop/MyApp/build.xml:49: taskdef class com.android.ant.SetupTask cannot be foundMarieann
thanks, i finally figured out what the problem was. I specified the sdk location manually instead of reading from local.properties <property name="sdk.dir" value="/Platforms/android.platform" />Marieann

© 2022 - 2024 — McMap. All rights reserved.