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

  • SEARCH
  • Home
  • 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 7180835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:25:55+00:00 2026-05-28T17:25:55+00:00

I am building a release version of my app using ant and proguard. The

  • 0

I am building a release version of my app using ant and proguard. The release version of my app is built successfully, however, the only portions of the code that get obfuscated are local variables. Methods and class variables are all retaining their exact names. Adding to my confusion is the fact that the mapping.txt file gets generated every time I build, and I see methods and class variables being mapped to something else. However, when I use Dex2Jar to deconstruct my .apk file, I don’t see any of the mappings.

I recently upgraded ADB to r16. Before this update, I was using a version of ADB that was pre-r14. Using the pre-r14 version of ADB, I had been successfully obfuscating my app for about a year. I was able to verify that these pre-r14 .apks were completely obfuscated by deconstructing them as well.

Can someone tell me why the method names and class variables are not being obfuscated? I have included my build files down below. Though the structure of some of the build files is a bit different after upgrading to r16, I am essentially following the same steps that I used to follow when using the pre-r14 ADB, so I don’t understand why I’m getting different behavior.

proguard.cfg:

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

-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 * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public interface com.android.vending.licensing.ILicensingService

-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 *;
}

build.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project [ <!ENTITY add-proguard-release SYSTEM "add-proguard-release.xml">]>
<project name="MyApp" default="help">

&add-proguard-release;

<property file="local.properties" />

<property file="ant.properties" />

<loadproperties srcFile="project.properties" />

<fail
    message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
    unless="sdk.dir"/>

<!-- Custom Android task to deal with the project target, and import the
         proper rules.
     This requires ant 1.6.0 or above. -->
<path id="android.antlibs">
    <pathelement path="${sdk.dir}/tools/lib/anttasks.jar" />
    <pathelement path="${sdk.dir}/tools/lib/sdklib.jar" />
    <pathelement path="${sdk.dir}/tools/lib/androidprefs.jar" />
</path>

<taskdef name="setup"
    classname="com.android.ant.SetupTask"
    classpathref="android.antlibs" />

<import file="${sdk.dir}/tools/ant/build.xml" />

  • 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-28T17:25:56+00:00Added an answer on May 28, 2026 at 5:25 pm

    Initially I was confused by your build.xml’s references to “add-proguard-release”. Now I see that these references were once necessary to add Proguard support to the build process. However, proguard support is now built into the master SDK_DIR/tools/ant.xml itself. (I think it came in before r16 in fact)

    In short – you don’t need these references, just the proguard.cfg file to be present. I’d just create the sample project from the command line as described in the dev guide and use the generated build.xml as the basis for your project’s build.xml. It will probably work right ‘out of the box’. It certainly does for me. My release builds which are built using Ant (you’ll need Ant version 1.8) from the command line have their methods obfuscated OK.

    P.S. You also need to have the line: proguard.config=proguard.cfg in the project.properties file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

building a site using PHP and MySQL that needs to store a lot of
I'm building an app that has several different sections to it, all of which
I'm building a version of an App I have already released, but with a
My team is considering building our next web app using the ASP.NET MVC framework.
I'm building my first Android app and its nearly ready for release. One thing
I have two manifests that I swap round when building different releases of my
I'm building a product that will ship after .Net 4.0 is released. Is MEF
Building a mobile site and wanted to create a rotator that would work just
Building a lottery scratch-card app in Java. Have allot of it done, just need
I am building an iOS application for public release, and I would like to

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.