stoefln
stoefln

Reputation: 14556

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

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!

Upvotes: 15

Views: 16121

Answers (7)

Werner Altewischer
Werner Altewischer

Reputation: 10466

To view the warnings add the option -verbose to your proguard file and grep the warnings from the gradle output:

./gradlew -i clean assemble<buildtype> | grep -i "warning"

where build type can be Release or any other build type you defined which contains the proguard configuration.

Upvotes: 1

Houssin Boulla
Houssin Boulla

Reputation: 2859

Juste add ignore warnings in proguard: https://stackoverflow.com/a/59428966/7308789

Upvotes: 0

Alberto M
Alberto M

Reputation: 1760

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

-ignorewarnings

At the end of proguard-rules.pro

Upvotes: 13

Jaydeep Dobariya
Jaydeep Dobariya

Reputation: 465

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

Upvotes: 0

Sfiso Collen
Sfiso Collen

Reputation: 1

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

Upvotes: 0

Anonymousism
Anonymousism

Reputation: 1

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

-dontwarn com.

Upvotes: 0

ישו אוהב אותך
ישו אוהב אותך

Reputation: 29783

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"
}

Upvotes: 14

Related Questions