Proguard error: "Exception while processing task java.io.IOException: Please correct the above warnings first"

proguard dontwarn
proguard-android
proguard ignore warnings
proguard obfuscation example
proguard can't find referenced class
what is proguard
proguard library
proguard not working android studio

Since upgrading to android gradle plugin 3.0.1 I am getting following error:

Warning: Exception while processing task java.io.IOException: Please correct the above warnings first.

:app:transformClassesAndResourcesWithProguardForProductionRelease FAILED

Problem is: I don't see any warning in my log.

I also ran the build with -i flag and I am getting following (big) log: https://gist.github.com/stoefln/b5e5e899c73b52d8065a5daeead716b3

Any ideas are very welcome!

This is because in your dependencies there are multiples rxjava implicit dependencies with different version.

From this log:

Reading program jar [/Users/steph/.gradle/caches/modules-2/files-2.1/io.reactivex/rxjava/1.2.5/b423532b5a3c949cbb799468f83bf566032fe98d/rxjava-1.2.5.jar] (filtered)

and

Reading library jar [/Users/steph/.gradle/caches/modules-2/files-2.1/io.reactivex/rxjava/1.2.3/7fe1a94c1aeb958acc876fe616922cc191f3222c/rxjava-1.2.3.jar] (filtered)

You can see that in your app, there is 2 version of rxjava: 1.2.3 and 1.2.5

One of your dependencies, android-rxlocationsettings, is using rxjava 1.2.5, you can take a look at its build.gradle:

apply plugin: 'com.android.library'

dependencies {
  compile 'pl.charmas.android:android-reactive-location:0.10@aar'
  compile 'com.google.android.gms:play-services-location:10.0.1'
  compile 'com.android.support:support-v4:25.0.1'
  compile 'io.reactivex:rxjava:1.2.5'
}

android {
  compileSdkVersion 25
  buildToolsVersion "25.0.2"

  defaultConfig {
    minSdkVersion 14
  }
}

So, you need to exclude it either using exclude from dependency:

dependencies {
  ...
  compile ('com.github.jetradarmobile:android-rxlocationsettings:1.1.0') {
    exclude group: "io.reactivex", name: "rxjava"
  }
  ...
}

or using configuration:

configurations.all {
    exclude group: "io.reactivex", module:"rxjava"
}

ProGuard icon ProGuard manual, InvalidClassException, class loading error, or verification error (in Java Micro Edition). Error: No Such Field or Method, Error verifying method (in a Java Micro  Xamarin has built-in support for Proguard. However, you may run into following error when you enable Proguard. Proguard error ‘C:\Program Files (Access is Denied)’ This is caused by a space in the path for Android-SDK location (which is where Proguard resides).

The only thing that worked for me was this answer by @Moti Bartov

-ignorewarnings

At the end of proguard-rules.pro

Troubleshooting ProGuard issues on Android, There are many reasons why you might want to enable ProGuard when While some errors will prevent you from building your app, there are  Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question. Provide details and share your research! But avoid … Asking for help, clarification, or responding to other answers. Making statements based on opinion; back them up with references or personal experience. To learn more, see our tips on writing great

just use -dontwarn in proguard-rules.pro like below

-dontwarn com.

ProGuard Troubleshooting, This appears to be new as I have changed no code and was working 2 weeks ago All i did was flutter upgrade. FAILURE: Build failed with an  And there are some options when doing it, everything works fine, except for proGuard, when I activate proGuard I get an error like this: java.exe exited with code 1 So, I've updated the proGuard forlder downloading the most recente version at sourceforge with the 6.1 version. But it still doesn't work.

I had a similar issue, in my case I checked the logs for warnings if you find any related to class reference, it indicates you need to clean build the project.

run gradlew clean followed by

gradlew build

or combined gradlew clean build

Build Failed

Warnings to look out for

Android release build crashes with proguard error · Issue #25951 , Proguard error after upgrating stable to v1.9.1+hotfix.2 #40168. Closed. yaymalaga opened this issue on Sep 10, 2019 · 21 comments. Closed  Yes, it works without ProGuard. Besides, it also works with ProGuard while not linking. I'm not using a custom ProGuard config, so I use the one bundled with the Xamarin.Android SDK (8.3.3.2). See below. I wanted to use ProGuard because it is beneficial for size and performance of the app. The other consideration to use ProGuard is because of

try this (it's work for me)

I have also issue with pro guard but i found following code from git hub more useful.

add this line on proguard-rules.pro

-dontoptimize
-dontpreverify

Proguard error after upgrating stable to v1.9.1+hotfix.2 · Issue , In fact, R8 works with all of your existing ProGuard rules files, so updating the To fix errors and force R8 to keep certain code, add a -keep line in the ProGuard​  R8 and ProGuard have slightly different supported behaviors. Aside from the aforementioned optimization rules that have no effect in R8, there are also rules that are unique to R8 that ProGuard will error on due to not recognizing them. One such example is -identifiernamestring, which is used by Dagger. More and more Android libraries have started to expect R8 usage in consumers, so it's important to be mindful of this if you use ProGuard.

Shrink, obfuscate, and optimize your app, Hello, I have finished an android app and want to deploy to Google Play Store, i tried using the Proguard option to shrink and protect the file but  ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier. It detects and removes unused classes, fields, methods, and attributes. It optimizes bytecode and removes unused instructions.

PROGUARD Error: Please correct the above warnings first , Android ProGuard is a Java class file shrinker, optimizer, and pre-verifier. The following error message may be displayed when ProGuard  ProGuard offers residential oil heat customers protection for underground and aboveground oil storage tanks and lines. Should a release ever occur, you can feel completely secure. This program affordably provides the peace of mind you deserve and ensures that any problems will be handled in a way that protects the environment.

ProGuard, I have tried adding those proguard rules : -dontwarn kotlin. -keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {} -keepnames  The following error message may be displayed when ProGuard reads its configuration file: Unknown option '-keep' in line 1 of file 'proguard.cfg' This issue typically happens on Windows because the .cfg file has the wrong encoding. ProGuard cannot handle byte order mark (BOM) which may be present in text files. If a BOM is present, then ProGuard will exit with the above error.

Comments
  • You should run your build with the -i flag and add -verbose to your proguard rules to get more output. The warning should be printed right after reading the library which has the problem.
  • can you please also add how you found out about the conflict?
  • @stoefln: you can found it from Note: duplicate definition of library class [rx.BackpressureOverflow$Strategy]. rx.*** is part of rxjava. Btw, you also have another duplicate library, it's probably android httpclient. every line with Note: duplicate definition of library class is telling you that you have duplicate dependencies whether explicitly or implicitly.
  • Thanks, makes sense. And how did you find out which libraries are referencing rx?
  • It's simple, if you try founding for rx. occurances in your log, you will found out something like this: Note: duplicate definition of library class [rx.plugins.RxJava.**. Which means rx.** is the package of rxjava. Then go to the rxjava github to make sure. There you will found out that the package is for rxjava version 1.
  • Yes, you're correct. You can use ./gradlew app:dependencies to see the dependencies tree. Or you can get a quick glance of your dependencies tree in your project by selecting the Project toolbar on the left then change Android to Project. You can see the library from External Libraries.