FAQ Database Discussion Community


Proguard find classes which does not exist

java,proguard
I want to user proguard to pack my jar files. One of the dependency is named jersey which is pulled in by 3rd party library. I am sure this jersey library is available on the machine I intended to deploy my jar, so I decided to remove it from my...

How to change the proguard mapping file name in gradle for Android project

android,gradle,mapping,proguard,obfuscation
I have android project based on gradle and I want to change mapping.txt file name after it's generated for my build. How can it be done? upd How it can be done in build.gradle? Since I have access there to my flavors and other stiff, I would like to create...

NoClassDefFoundError Proguard Activity

java,android,android-activity,proguard
I'm using Proguard to obfuscate my Android app. Everything works perfectly except for one Activity. java.lang.NoClassDefFoundError: com.myapp.android.MediaActivity When I don't use Proguard the Activity is working fine. I only have this issue when using Proguard. My Activity is declared on the AndroidManifest and all my others Activity are working fine,...

ProGuard: ClassCastException

java,gson,proguard,obfuscation
I'm getting this annoying ClassCastException when I obfuscate my Java code (which works fine before I obfuscate using ProGuard). java.lang.ClassCastException: com.google.gson.internal.StringMap cannot be cast to net.minecraft.launcher.profile.Profile at java.lang.ClassCastException: com.google.gson.internal.StringMap cannot be cast to net.minecraft.launcher.profile.Profile at net.minecraft.launcher.profile.ProfileManager.getSelectedProfile(SourceFile:117) at net.minecraft.launcher.g.run(SourceFile:184) at...

Pass 1.1.3 - Proguard

android,proguard,fingerprint
When I generate apk release using proguard and using libraries necessary to Fingerprint Samsung (pass-v1.1.3.jar, sdk-v1.0.0.jar), I get the following error: Proguard returned with error code 1. See console [2015-05-07 19:56:57 - ] Warning: com.samsung.android.sdk.pass.SpassFingerprint$b: can't find superclass or interface com.samsung.android.fingerprint.IFingerprintClient$Stub [2015-05-07 19:56:57 - ] Warning: com.samsung.android.sdk.pass.SpassFingerprint$c: can't find superclass...

Proguard obfuscation of multi jar project

java,proguard
I have successfully configured Proguard with Maven to obfuscate a jar, and its dependant jar. I have managed to get both obfuscations to use the same mapping file, so that one jar can call the methods of the other. The problem I am facing, is that Proguard is not keeping...

ProGuard issues with Android Archieve(.aar) library

android-studio,proguard,aar
I've a library project which I want to distribute, in AAR format. I've applied ProGuard on it. ProGuard settings works well if I use this lib as a module, but not when I use resulting AAR. Basically it fails with exception "java.lang.IllegalArgumentException: already added Lmy/lib/package/name/R;" in Application project. ProGuard is...

How can I make the ProGuard Maven plugin use the most recent ProGuard version?

java,maven,maven-3,proguard,obfuscation
I have a pom.xml file given below. When I run mvn clean install, I get the error [proguard] Error: Can't read [C:\Program Files\Java\jdk1.8.0_20\jre\lib\rt.jar] (Can't process class [com/oracle/net/Sdp$1.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7))) I tried to upgrade the ProGuard version and set it to 5.2 in the...

Android: Proguard rules for dependencies and modules

android,dependencies,proguard
I have a project with a couple of modules, some jar dependencies in libs folder and some some other gradle dependencies. I am trying to build a release apk with proguard enabled but i am getting a lot of warnings during the build process for certain dependencies. e.g this: Warning:org.codehaus.jackson.jaxrs.JacksonJsonProvider:...

Crash: IllegalStateException: You need to use a Theme.AppCompat theme

android,android-studio,proguard,android-5.0-lollipop
I am getting a crash at startup when launching the activity. Stack Trace: main Process: com.haziqhussain.hazgames, PID: 10248 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.haziqhussain.hazgames/com.haziqhussain.hazgames.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) ...

Can't generate signed APK in Android Studio, because proguard-rules.txt is missing

android,android-studio,apk,proguard
I have a problem with generating signed APK in Android Studio. After fixing all the warnings I am stuck on this one: Error:Execution failed for task ':app:proguardRelease'. java.io.FileNotFoundException: /Users/franek/Documents/Android_Studio_Melange/app/proguard-rules.txt (No such file or directory) I don't want to change minifyEnabled to false, because I want to keep Proguard working. How...

Android Build with Gradle and ProGuard : “The output jar must be specified after an input jar, or it will be empty”

android,gradle,android-gradle,proguard,android-progaurd
I'm creating a build with different flavors with Gradle. It used to run quite good until now, until I wanted to enable Proguard. I enabled minifyEnabled for my Release Build and now I'm having an exception saying : "Caused by: org.gradle.internal.UncheckedException: java.io.IOException: The output jar [.../app/build/intermediates/multi-dex/dev/release/componentClasses.jar] must be specified after...

How to include TypeReference ProGuard rule

jackson,proguard
I have already included following line to keep all files inside the package. -keep class com.fasterxml.** { *; } I am getting following exception. Caused by: java.lang.IllegalArgumentException: Internal error: TypeReference constructed without actual type information at com.fasterxml.jackson.core.type.TypeReference.<init>(SourceFile:36) ...

Why can't I export the apk file from Eclipse when I turn on ProGuard?

android,proguard
[2015-03-13 02:48:07 - ScoresOnGo] Proguard returned with error code 1. See console [2015-03-13 02:48:07 - ScoresOnGo] Warning: com.google.android.gms.cast.TextTrackStyle: can't find referenced class android.view.accessibility.CaptioningManager [2015-03-13 02:48:07 - ScoresOnGo] Warning: com.google.android.gms.cast.TextTrackStyle: can't find referenced class android.view.accessibility.CaptioningManager$CaptionStyle [2015-03-13 02:48:07 - ScoresOnGo] Warning: com.google.android.gms.cast.TextTrackStyle: can't find referenced class...

Class not found when unmarshalling when Proguard enabled

android,proguard,parcelable
I've been dealing with what seems to be a Proguard configuration problem. My app is working fine when in debug, but the released apk gives me an exception when launching 2nd activity. It seems to happen when trying to retrieve Parcelable extras from Intent. Here is the stacktrace : E/Parcel﹕...

Proguard returned with error code 1 at the time of apk export

android,proguard
I am developing android application using parse library and many different library projects. For exporting apk file, i am using Pro Guard. While doing the export of the apk file i am receiving the following error, please help me out here. [2015-05-03 20:59:49 - SampleProject] Proguard returned with error code...

Proguard in Android Studio: Running proguardRelease complains of unresolved references

android,android-studio,proguard,android-gradle
I'm trying to use Proguard for my release in Android Studio. I have the classic problem that everyone has which is the "Unresolved references to classes or interfaces". Like I read everywhere, I tried to add -dontwarn command to the proguard-project.txt file but it doesn't change anything. Maybe my setup...

Proguard - also use proguard files from modules

android,android-studio,gradle,proguard,android-proguard
My projects build.gradle looks like following: android { compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig { applicationId "..." minSdkVersion 15 targetSdkVersion 22 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile project(':androKnife') } And my androKnife module does have it's own...

Problems running proguard for single jar - can't find java classes

java,jar,proguard
I'm trying to optimize jar using Proguard My config: -injars MyLib-1.0.jar -outjars MyLib-1.0.proguard.jar -libraryjars retrace.jar -libraryjars guava-18.0.jar -printmapping MyLib.map -keep public class MyLib { public String myPublicCallEntryPoint(java.lang.String); } -keep public class * { public protected *; } -keepclassmembernames class * { java.lang.Class class$(java.lang.String); java.lang.Class class$(java.lang.String, boolean); } Then I run...

Injected view null with roboguice 3 when minifiedEnabled = true

android,proguard,roboguice
I am using RoboGuice 3 in my application and when minifiedEnabled is set to false in debug mode everything is working fine. If I however, set minifiedEnabled to true the injected views seem to be null: NullPointerException: Attempt to invoke virtual method 'void android.support.v4.view.ViewPager.setAdapter(android.support.v4.view.PagerAdapter)' on a null object reference My...

Android TreeView lib and proguard encounter

android,proguard
There is really nice lib for creating tree view in android, AndroidTreeView. This library works fine until I enabled the proguard, then the app getting crashed. Note: i have a ViewPager with 5 fragments that all of them using treeview. With default progaurd setting i'm getting this error: java.lang.RuntimeException: Could...

What is the default for minifyEnabled for buildType not explicitly scripted?

android-studio,gradle,android-gradle,proguard,minify
I imported several eclipse projects to Android Studio (v1.1). In the original Eclipse environment, they use Proguard for release mode. In the Android Studio environment, this was translated to the following in the build.gradle script (by the import, not by me): buildTypes { release { minifyEnabled true proguardFiles 'proguard.cfg' }...

Tell Proguard to keep annotation on methods

java,android,annotations,proguard
I'm using my own annotation: @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.TYPE}) public @interface Loggable { } and obfuscate using Proguard. I use the -keepattributes *Annotation* in the Proguard configuration to keep the annotations. At runtime, when I retrieve the annotation from an annotated class using someClass.getAnnotation(Loggable.class) everything works - I retrieve a non-null...

Android-Studio-1.2.RC Proguard warnings on Square's Okio library reference

android,android-studio,proguard,square,okio
WIth Android Studio: 1.2.RC I enabled proguard in .gradle: ``` minifyEnabled=true and added these rules to my proguard-rules.pro: -dontwarn com.squareup.** -dontwarn okio.** and added these lint rules to my .gradle file: warningsAsErrors false abortOnError false disable 'InvalidPackage' ``` But I still get these warning when I try to run the...

Unknown Source when I use Proguard

android,proguard,minify,shrinkresources
My crash report is a little bit useless if I use Proguard (minifyEnabled true and shrinkResources true) This is the report with Proguard: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ProgressBar.setVisibility(int)' on a null object reference at xx.xxxx.xxx.xxxxx.xxxxxx.restoreViewAfterLoading(Unknown Source) at xx.xxxx.xxx.xxxxx.xxxxxx.newInstance(Unknown Source) onCreateView onViewCreated access$000 at xx.xxxx.xxx.xxxxx.xxxxxx$1.success(Unknown Source) at xx.xxxx.xxx.xxxxx.xxxxxx$1.success(Unknown...

proguard build in Android Studio. Getting error

android,android-studio,proguard
I am trying to config the proguard in android studio for my release build but I am getting error and warnings below: Error:Execution failed for task ':myAccount_S:proguardRelease'. java.io.IOException: Can't write [C:\Users\mgi\AndroidStudioProjects\MyProjects\myAccount_S\build\intermediates\classes-proguard\release\classes.jar] (Can't read...

how to include ACRA in ProGuard rule file

proguard,acra
i am configuring ProGuard for the entire Project. When i try to run the App .apk file got generted successfully. I get following exception in the line of ACRA initialization. java.lang.NoSuchFieldError: PUT at java.lang.Class.getDeclaredAnnotation(Native Method) at java.lang.Class.getAnnotation(Class.java:243) at cjw.a(SourceFile:124) ...

Android crash while using GSON Library and ProGuard

android,proguard
I am using the following Proguard configuration with GSON library: # Gson uses generic type information stored in a class file when working with fields. Proguard # removes such information by default, so configure it to keep all of it. -keepattributes Signature # For using GSON @Expose annotation -keepattributes *Annotation*...

Android studio 1.1.0 setting minifyEnabled true causing issues with app

android,android-studio,android-gradle,proguard,retrofit
Here's my gradle.build file defaultConfig { minSdkVersion 15 targetSdkVersion 21 versionCode 2 versionName "1.0" } buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } Proguard-rules.pro file -keepclassmembers class * extends de.greenrobot.dao.AbstractDao { public static java.lang.String TABLENAME; } -keep class **$Properties -dontwarn com.squareup.** -dontwarn okio.** -dontwarn retrofit.** -dontwarn org.joda.time.**...

Proguard optimization

android,proguard,android-proguard
I readed the proguard documentation like 10 times, but I really don't understand one thing: if I put -dontoptimize Optimization will disable, but if I want a full optimization, I have to only remove -dontoptimize or I have to write this? -dontoptimize -optimizations * Can I omit? -optimizations Thanks for...

MPAndroidChart compiling error with Proguard

gradle,proguard,mpandroidchart
When I include the latest library (2.0.7) using gradle and try to compile I get a warning from proguard, so I can't complie any more: Warning:com.github.mikephil.charting.charts.LineChart$DefaultFillFormatter: can't find referenced field 'boolean mStartAtZero' in program class com.github.mikephil.charting.charts.LineChart According to docs this is often an inconsistency while compiling, and I've tried to...

AppCompatActivity crashed at startup on physical mobile devices but not Android emulators

android,android-5.0-lollipop,proguard,acra,appcompat-v7-r22.1
I got the following errors with the AppCompatActivity class: 06-08 06:32:47.441 E/ACRA (7296): java.lang.AbstractMethodError: abstract method "void r.b(java.lang.CharSequence)" 06-08 06:32:47.441 E/ACRA (7296): at r.a(Unknown Source) 06-08 06:32:47.441 E/ACRA (7296): at android.support.v7.app.AppCompatActivity.onTitleChanged(Unknown Source) 06-08 06:32:47.441 E/ACRA (7296): at android.app.Activity.onPostCreate(Activity.java:1197) 06-08 06:32:47.441 E/ACRA (7296): at android.support.v7.app.AppCompatActivity.onPostCreate(Unknown Source)...

Proguard removing annotations in Android application

java,android,proguard,minify,javacv
I have included a project using gradle in my app: compile group: 'org.bytedeco', name: 'javacv', version: '0.11' Which builds fine. But whenever I run the app with proguard enabled, it apparently removes the @Platform annotation from the jars that get included then. I tried using the following based on http://proguard.sourceforge.net/manual/examples.html#annotations...

Android ProGuard retrace

android,proguard
I have following stacktrace, but ProGuard doesn't retrace it correctly with the corresponding mapping.txt. How can I find out, the com.example.app.util.d.d.a function? java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=0, data=null} to activity {com.example.app/com.example.app.MyActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.example.app.util.d.d.a(int, int, android.content.Intent)' on a null object reference at...

Enabling Proguard Throws Exception

android,proguard
I have added some external libs in my project and it works fine, but when I enabled proguard it throws exception every time. I have tried to exclude libs from proguard but my code not working. gradle: dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:21.0.3' compile 'com.google.code.gson:gson:2.3' compile 'com.android.support:support-v4:21.0.3'...

Android proguard returning error

android,proguard
[2015-04-30 14:32:32 - Alkhaliji] Proguard returned with error code 1. See console [2015-04-30 14:32:32 - Alkhaliji] Warning: com.google.android.gms.common.stats.zze: can't find referenced class android.support.v4.util.SimpleArrayMap [2015-04-30 14:32:32 - Alkhaliji] Warning: com.google.android.gms.common.stats.zze: can't find referenced class android.support.v4.util.SimpleArrayMap [2015-04-30 14:32:32 - Alkhaliji] Warning: com.google.android.gms.common.stats.zze: can't find referenced class android.support.v4.util.SimpleArrayMap...

Proguarding Google Play Services 7.+ results in com.google.android.gms.internal.zzig: can't find referenced method 'boolean isAttachedToWindow()'

android,google-play-services,proguard,android-proguard
I have an app that is close to the 65K method count limit. I'm currently using Proguard without obfuscation # This is a configuration (rules) file for ProGuard. -dontobfuscate -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontskipnonpubliclibraryclassmembers # Dex does not like code run through the ProGuard optimize and preverify steps # (and performs some...

Proguard not generating anything in build/outputs/mapping/release

android,eclipse,android-studio,proguard
I've migrated my app from ADT to Android Studio as it become the Official IDE. But I recently found out that I can decompilate it, and my source is clear. I spent A LOT OF TIME in eclipse to obfuscate my apk, so I still have my Proguard File, this...

Error when exporting Android APK with LibGDX and ProGuard

android,eclipse,libgdx,apk,proguard
I’m trying to export an Android APK with Proguard and I’m getting this error: [2015-05-06 19:29:31 - Metronome-android] Proguard returned with error code 1. See console [2015-05-06 19:29:31 - Metronome-android] proguard.ParseException: Unknown option '(' in argument number 14 [2015-05-06 19:29:31 - Metronome-android] at proguard.ConfigurationParser.parse(ConfigurationParser.java:191) [2015-05-06 19:29:31 - Metronome-android] at proguard.ProGuard.main(ProGuard.java:484)...

How to configure ProGuard to keep names of inner class members?

android,proguard
I want to obfuscate my app with ProGuard and I also want member of some inner classes to keep their names. This is because I use these classes in Jackson for converting to and from JSON. My source: // this class mainly serves as a container for a group of...

Can't get Ad, Flurry 5.3 with ProGuard

android,proguard,flurry
My app can't get flurry ad when build app for release in google play with ProGuard. If i run app without ProGuard everything work fine. I enable Log and flurry SDK write next information: 02-20 16:31:09.765 8953-8953/? D/FlurryAdServingApp﹕ fetchAndDisplay: Banner 02-20 16:31:14.885 8953-8953/? D/FlurryAdServingApp﹕ Failed 20 02-20 16:31:17.960 8953-9041/? W/System.err﹕...

Proguard Stack in Crashlytics

android,proguard,crashlytics
I have several recurrent logs in Crashlytics that I can't read. java.lang.NullPointerException at ahm.onClick(SourceFile:239) at android.view.View.performClick(View.java:4212) at android.view.View$PerformClick.run(View.java:17476) at android.os.Handler.handleCallback(Handler.java:800) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:194) at android.app.ActivityThread.main(ActivityThread.java:5431) at java.lang.reflect.Method.invokeNative(Method.java) at...

App crashes in release mode only, how to configure proguard?

android,crash,proguard,release-mode
My app crashes in release mode only, due to proguard (confirmed, I disabled it and worked)... I see somebody had the same problem and tried some solutions like this one: Android: app crashed when starting after signing in release mode . I first tried keeping the MainActivity, then tried keeping...

Proguard removes overridden methods in abstract class as unused

java,proguard
Proguard is removing the overridden methods in an abstract class as unused, even though they are used in the parent class. Here is a reference implementation showing the behaviour public abstract class Animal { Animal() { born(); } abstract void born(); } public abstract class Human extends Animal { @Override...

How to include a proguard configuration in my Android library (AAR)

android,gradle,proguard,aar
Android libraries, per the AAR file spec [1], includes a 'proguard.txt' file. My understanding is that this file declares how the library correctly can be obfuscated and minified. In my case I need to preserve some API-classes. How can I declare the library's proguard.txt file in the library's build.gradle? And will...