Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6083041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:21:24+00:00 2026-05-23T11:21:24+00:00

I’m developing apps for Android and using Proguard to obfuscate the code. Currently i’m

  • 0

I’m developing apps for Android and using Proguard to obfuscate the code.

Currently i’m using ProGuard configurations:

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class com.android.vending.licensing.ILicensingService

To maintain custom components names that are used on layouts XML:

-keep public class custom.components.**

To remove debug logs:

-assumenosideeffects class android.util.Log {
    public static *** d(...);
    public static *** v(...);
}

To avoid changing names of methods invoked on layout’s onClick:

-keepclassmembers class * {
 public void onClickButton1(android.view.View);
 public void onClickButton2(android.view.View);
 public void onClickButton3(android.view.View);
}

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

The question is (are):

Are any other tags recommended? Why and what for?

It’s possible to make a comment on a proguard.cfg file? I would like to have it with comments for what some lines are doing so that other developers don’t have doubts about why i added.

Also in proguard, is it possible to maintain the comment header of a file (with the copyright)? If it’s not, or it’s not a good policy where should i add the copyright?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:21:24+00:00Added an answer on May 23, 2026 at 11:21 am

    Android SDK (r20 or higher)

    Please check the predefined proguard.config refered in project.properties

    proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt
    

    More info: http://proguard.sourceforge.net/manual/examples.html#androidapplication

    Here you can check a proguard “default” file that I keep updating: https://medium.com/code-procedure-and-rants/android-my-standard-proguard-ffeceaf65521


    Android SDK (r19 or lower)

    Based on my answer Enabling ProGuard in Eclipse for Android I’ve ended up with this generic file. I’ve added comments to remember what each line is for. It might help people out there so here it is:

    -optimizationpasses 5
    
    #When not preverifing in a case-insensitive filing system, such as Windows. Because this tool unpacks your processed jars, you should then use:
    -dontusemixedcaseclassnames
    
    #Specifies not to ignore non-public library classes. As of version 4.5, this is the default setting
    -dontskipnonpubliclibraryclasses
    
    #Preverification is irrelevant for the dex compiler and the Dalvik VM, so we can switch it off with the -dontpreverify option.
    -dontpreverify
    
    #Specifies to write out some more information during processing. If the program terminates with an exception, this option will print out the entire stack trace, instead of just the exception message.
    -verbose
    
    #The -optimizations option disables some arithmetic simplifications that Dalvik 1.0 and 1.5 can't handle. Note that the Dalvik VM also can't handle aggressive overloading (of static fields).
    #To understand or change this check http://proguard.sourceforge.net/index.html#/manual/optimizations.html
    -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
    
    #To repackage classes on a single package
    #-repackageclasses ''
    
    #Uncomment if using annotations to keep them.
    #-keepattributes *Annotation*
    
    #Keep classes that are referenced on the AndroidManifest
    -keep public class * extends android.app.Activity
    -keep public class * extends android.app.Application
    -keep public class * extends android.app.Service
    -keep public class * extends android.content.BroadcastReceiver
    -keep public class * extends android.content.ContentProvider
    -keep public class com.android.vending.licensing.ILicensingService
    
    
    #To remove debug logs:
    -assumenosideeffects class android.util.Log {
        public static *** d(...);
        public static *** v(...);
    }
    
    #To avoid changing names of methods invoked on layout's onClick.
    # Uncomment and add specific method names if using onClick on layouts
    #-keepclassmembers class * {
    # public void onClickButton(android.view.View);
    #}
    
    #Maintain java native methods 
    -keepclasseswithmembernames class * {
        native <methods>;
    }
    
    #To maintain custom components names that are used on layouts XML.
    #Uncomment if having any problem with the approach below
    #-keep public class custom.components.package.and.name.**
    
    #To maintain custom components names that are used on layouts XML:
    -keep public class * extends android.view.View {
        public <init>(android.content.Context);
        public <init>(android.content.Context, android.util.AttributeSet);
        public <init>(android.content.Context, android.util.AttributeSet, int);
        public void set*(...);
    }
    
    -keepclasseswithmembers class * {
        public <init>(android.content.Context, android.util.AttributeSet);
    }
    
    -keepclasseswithmembers class * {
        public <init>(android.content.Context, android.util.AttributeSet, int);
    }
    
    #Maintain enums
    -keepclassmembers enum * {
        public static **[] values();
        public static ** valueOf(java.lang.String);
    }
    
    #To keep parcelable classes (to serialize - deserialize objects to sent through Intents)
    -keep class * implements android.os.Parcelable {
      public static final android.os.Parcelable$Creator *;
    }
    
    #Keep the R
    -keepclassmembers class **.R$* {
        public static <fields>;
    }
    
    ###### ADDITIONAL OPTIONS NOT USED NORMALLY
    
    #To keep callback calls. Uncomment if using any
    #http://proguard.sourceforge.net/index.html#/manual/examples.html#callback
    #-keep class mypackage.MyCallbackClass {
    #   void myCallbackMethod(java.lang.String);
    #}
    
    #Uncomment if using Serializable 
    #-keepclassmembers class * implements java.io.Serializable {
    #    private static final java.io.ObjectStreamField[] serialPersistentFields;
    #    private void writeObject(java.io.ObjectOutputStream);
    #    private void readObject(java.io.ObjectInputStream);
    #    java.lang.Object writeReplace();
    #    java.lang.Object readResolve();
    #}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.