Android Build with Gradle and ProGuard : "The output jar must be specified after an input jar, or it will be empty" -
i'm creating build different flavors gradle. used run quite until now, until wanted enable proguard. enabled minifyenabled release build , i'm having exception saying :
"caused by: org.gradle.internal.uncheckedexception: java.io.ioexception: output jar [.../app/build/intermediates/multi-dex/dev/release/componentclasses.jar] must specified after input jar, or empty."
does know causing exception ? want enable proguard before release application. here gradle file below.
lintoptions { abortonerror false } dexoptions{ incremental true javamaxheapsize "4g" } defaultconfig { applicationid "..." minsdkversion 14 targetsdkversion 22 versioncode 1 versionname "1.0" multidexenabled true } buildtypes { release { minifyenabled true proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' signingconfig signingconfigs.release } debug { minifyenabled false shrinkresources false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' signingconfig signingconfigs.debug } } proguard rules file.
# add project specific proguard rules here. # default, flags in file appended flags specified # in /users/osayilgan/development/android/sdk/tools/proguard/proguard-android.txt # can edit include path , order changing proguardfiles # directive in build.gradle. # # more details, see # http://developer.android.com/guide/developing/tools/proguard.html # add project specific keep options here: # if project uses webview js, uncomment following # , specify qualified class name javascript interface # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} -keepnames public class * extends io.realm.realmobject -keep class io.realm.** { *; } -dontwarn javax.** -dontwarn io.realm.** and here proguard-android file. default 1 android sdk.
# configuration file proguard. # http://proguard.sourceforge.net/index.html#manual/usage.html -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -verbose # optimization turned off default. dex not code run # through proguard optimize , preverify steps (and performs # of these optimizations on own). -dontoptimize -dontpreverify # note if want enable optimization, cannot # include optimization flags in own project configuration file; # instead need point # "proguard-android-optimize.txt" file instead of 1 # project.properties file. -keepattributes *annotation* -keep public class com.google.vending.licensing.ilicensingservice -keep public class com.android.vending.licensing.ilicensingservice # native methods, see http://proguard.sourceforge.net/manual/examples.html#native -keepclasseswithmembernames class * { native <methods>; } # keep setters in views animations can still work. # see http://proguard.sourceforge.net/manual/examples.html#beans -keepclassmembers public class * extends android.view.view { void set*(***); *** get*(); } # want keep methods in activity used in xml attribute onclick -keepclassmembers class * extends android.app.activity { public void *(android.view.view); } # enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations -keepclassmembers enum * { public static **[] values(); public static ** valueof(java.lang.string); } -keep class * implements android.os.parcelable { public static final android.os.parcelable$creator *; } -keepclassmembers class **.r$* { public static <fields>; } # support library contains references newer platform versions. # don't warn in case app linking against older # platform version. know them, , safe. -dontwarn android.support.**
it took quite while me figure out but, had guessed, proguard configuration.
i started dig through warnings in console , realized of references couldn't found proguard. adding them -dontwarn proguard configuration file solved problem.
in case, had ignore packages below;
-dontwarn java.lang.invoke** -dontwarn org.apache.lang.** -dontwarn org.apache.commons.** -dontwarn com.nhaarman.** -dontwarn se.emilsjolander.**
Comments
Post a Comment