Questions tagged [android-proguard]

The ProGuard tool shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names. The result is a smaller sized .apk file that is more difficult to reverse engineer.

The ProGuard tool shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names. The result is a smaller sized .apk file that is more difficult to reverse engineer. Because ProGuard makes your application harder to reverse engineer, it is important that you use it when your application utilizes features that are sensitive to security like when you are Licensing Your Applications.

ProGuard is integrated into the Android build system, so you do not have to invoke it manually. ProGuard runs only when you build your application in release mode, so you do not have to deal with obfuscated code when you build your application in debug mode. Having ProGuard run is completely optional, but highly recommended.

Official Documentation

1030 questions
25
votes
4 answers

Where is proguard-rules.txt in android studio?

In my demo project, proguard-rules.txt is not available in Android studio. I must be missing some code : Where can I find proguard-rules.txt file? I want to add proguard rules Any help is appriciated Thank you
Kushal
  • 8,100
  • 9
  • 63
  • 82
22
votes
1 answer

Updating Play services from 8.1 to 8.3 with Proguard enabled

I tried to update play services to 8.3. Here's what I changed : In the root gradle file : dependencies { classpath 'com.android.tools.build:gradle:1.5.0-beta1' classpath 'com.google.gms:google-services:1.5.0-beta2' } And in the app gradle…
FallasB
  • 953
  • 1
  • 9
  • 11
21
votes
6 answers

Only using Proguard: Could not init DaoConfig => ArrayIndexOutOfBoundsException

I am using the following ProGuard rules: -keepclassmembers class * extends org.greenrobot.greendao.AbstractDao { *; } -keep class **$Properties -keep class org.greenrobot.greendao.** -keepclassmembers class org.greenrobot.greendao.** { *; } # If…
muetzenflo
  • 5,653
  • 4
  • 41
  • 82
20
votes
2 answers

After Updating Android Studio 3.1, I am getting these warnings after each build

Android Issues Warnings Stripped invalid locals information from 1 method. Stripped invalid locals information from 1 method. Message{kind=WARNING, text=Stripped invalid locals information from 1 method., sources=[Unknown source file], tool…
20
votes
1 answer

Android how to place all my classes in one package using Proguard

I am developing SDK, my environment got SDK library and a testing project that use it. I want to protect my library code from my library users and there for I need to obfuscate it, but just it. So in Android Studio in my library Module, in…
Ilya Gazman
  • 31,250
  • 24
  • 137
  • 216
19
votes
3 answers

Android Proguard warning: can't write resource (Duplicate zip entry)

I enabled proguard and got: Warning:can't write resource [META-INF/LICENSE.txt] (Duplicate zip entry [commons-io-2.4.jar:META-INF/LICENSE.txt]) Warning:can't write resource [META-INF/NOTICE.txt] (Duplicate zip entry…
Daniel Gomez Rico
  • 15,026
  • 20
  • 92
  • 162
18
votes
1 answer

dagger android support proguard rules

I'm using Dagger2 android-support library with Proguard but i can't compile my project because of this error : Warning:dagger.android.AndroidInjector: can't find referenced class…
Mahdi Nouri
  • 1,391
  • 14
  • 29
18
votes
7 answers

Android - Proguard and retrofit 2?

I am using from Proguard for my project and bellow code is in my proguard-rules.pro : # Retrofit -keep class com.google.gson.** { *; } -keep class com.google.inject.** { *; } -keep class org.apache.http.** { *; } -keep class…
user4813855
18
votes
2 answers

Android design support library proguard rules

Have been trying to find some information about the rules needed for the new design support library to work passing proguard. I couldn't find any information about it. Ended up using these rules: -keep class android.support.design.widget.** { *;…
16
votes
4 answers

NullPointerException due Attempt to invoke virtual method 'android.os.IBinder android.view.SurfaceControl.getHandle()' on a null object reference

Recently I did migration of my application to targetSdkVersion = 28. After publishing the updated app to Google Play I started to get very strange crash reports in Fabric.io: Crash report Fatal Exception: java.lang.NullPointerException Attempt to…
16
votes
2 answers

Unable to build a release build in Kotlin

After having converted my Android project to Kotlin I am unable to build a release build, the error appears to be related to Proguard. I see 155 warnings like Warning:com.example.app.activity.MainActivity$1: can't find referenced field…
Francesc
  • 25,014
  • 10
  • 66
  • 84
16
votes
1 answer

Proguard doesnt preserve the line numbers and method names in stacktrace

Here are few lines from proguard-rules.pro -keepattributes *Annotation* -keepattributes Signature -keepattributes InnerClasses,EnclosingMethod -renamesourcefileattribute SourceFile -keepattributes SourceFile,LineNumberTable -keep public class…
mobileDev
  • 1,358
  • 2
  • 14
  • 34
16
votes
4 answers

How to not obfuscate interface methods & its parameters using Proguard in Android?

I have the following code: public class MyClass { public void method1(Integer marks) { } private String method3(String name){ } public interface interface1 { void method4(Integer ID); void method5(Integer rate,…
Pushpa
  • 892
  • 1
  • 12
  • 30
16
votes
2 answers

Android Proguard Issue - Still getting "java.io.IOException: Can't process class..." error when obfuscation is skipped

I am building an android app with proguard in Android Studio and my project has a library jar (na.jar) that I would like to skip obfuscation and preverification because some classes from the na.jar are giving me errors during the build. So in my…
16
votes
1 answer

Obfuscate private fields using ProGuard

I'm using ProGuard in AndroidStudio 1.2.1.1 with Gradle 1.2.3. My Gradle's release build is configured like so: minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' shrinkResources true I would like…
shkschneider
  • 17,833
  • 13
  • 59
  • 112
1
2
3
68 69