1

When i try to do minify enabled true in my build.gradle file using below code application is crashed :

Code

buildTypes {
    release {
        debuggable false
        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
    debug{
        debuggable true
        minifyEnabled true
        shrinkResources false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
  • when I did: minifyEnabled true after building release apk: app-release.apk, the app crashed.
  • when I did: minifyEnabled false after building release apk: app-release.apk, the build is okay.

enter image description here

Mahavir Jain
  • 1,448
  • 10
  • 23
BacII
  • 39
  • 1
  • 6

3 Answers3

0

As indicated ref resource, minifyEnabled will remove unused codes. In your situation, there might be methods which is used with JNI or else and compiler did not known it's used. Again according to ref, you can specify which files to keep from examination of built-in minify (same as proguard). The answer is here

0

As given in the error message the classloader was not able to find the class org.apache.xerces.datatype.DatatypeFactoryImpl

Proguard is changing the class name to stop this from happening you can add

-keep class org.apache.**{ *; }

in your progurad-rules.pro file

Kundan Singh
  • 91
  • 1
  • 6
0

Add this to proguard

-keep public class jp.co.soramitsu.iroha.android.** {
      public protected *;
      public private *;
}
Bhoomin Naik
  • 402
  • 4
  • 7