Obfuscate using Andorid SDK

Posted: July 27, 2009 in Android, Java, Mobile
Tags:
Image representing Android as depicted in Crun...
Image via CrunchBase

ANT task for obfuscating using Proguard in Android development:

<target name="-obfuscate" depends="compile.incremental">
			<!-- In versin prior to 4.4 Peephole optimization was turned off
			     however in 4.4beta is now on and thus we
			     have turn off with the command of
			     -optimizations !code/simplification/cast -->
<proguard>
			  -libraryjars ${android.jar}: ${external-libs-folder}
			  -injars      ${out-classes-location}
			  -outjars     ${obfuscate-location}/classes.min.jar
			  -keep public class * extends android.app.Activity
			  -optimizations !code/simplification/cast
			</proguard>

		</target>

Notice the extra -optimizations command. That is required to turn off a new proguard feature to make it work.

Reblog this post [with Zemanta]
Advertisements
Comments
  1. I’m trying to use proguard and ant but it seems proguard can’t find the google MapView APIs. how can I tell Proguard where this classes are?

    I have a lot of: can’t find referenced class com.google.android.maps.OverlayItem

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s