Issues with Proguard Minify

I am having some issues with Proguard, and I wasn’t able to find anything about it in the documentation or in the forums so far.

I took the sample project:

https://github.com/CoronaCards/sample-android-ChildView

Since it’s 2 years out of date, and wouldn’t compile, I updated the following:

  1. Upgraded Gradle plugin from 2.2.3 to 3.2.1 (and added google() as a repository)
  2. Upgraded Gradle version from 2.14.1 to 4.10.1
  3. Upgraded compile and target SDK from 23 to 28
  4. Upgraded build tools version to 23.0.3 to 28.0.3
  5. Upgraded support library versions from 23.4.0 to 28.0.0

I then dropped in the latest CoronaCards release (CoronaCardsLibrary.2018.3326)

Finally, I enabled proguard minification on the debug build:

buildTypes { debug { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } release { ... } }

At this point, trying to assemble (./gradlew assembleDebug) will result in a bunch of proguard warnings and finally throw an exception. I am not sure of the exact cause.

Are there some required proguard rules required for this library?

Adding these proguard rules seem (pending further testing) to have fixed the problem:

-keep class com.naef.\*\* { \*; } -keep class com.ansca.\*\* { \*; } -dontwarn com.naef.\*\* -dontwarn org.apache.http.\*\* -dontwarn android.webkit.\*\*

Only downside I have found so far is that it does not seem compatible with Instant Run? I had to disable it in Android Studio or it kept giving errors.

Adding these proguard rules seem (pending further testing) to have fixed the problem:

-keep class com.naef.\*\* { \*; } -keep class com.ansca.\*\* { \*; } -dontwarn com.naef.\*\* -dontwarn org.apache.http.\*\* -dontwarn android.webkit.\*\*

Only downside I have found so far is that it does not seem compatible with Instant Run? I had to disable it in Android Studio or it kept giving errors.