performance - Getting Can't find common super class of [com/loopj/android/http/MySSLSocketFactory] after enabling Pro-guard -
after enabling pro-guard, receiving around 1000 warnings. after adding rules , following this , this answers on stackoverflow, receiving 1 warning , 1 error.
this getting now.
warning:exception while processing task java.io.ioexception: java.lang.illegalargumentexception: can't find common super class of [com/loopj/android/http/mysslsocketfactory] (with 1 known super classes) , [java/security/keystore] (with 2 known super classes) error:execution failed task ':app:transformclassesandresourceswithproguardforrelease'.
java.io.ioexception: java.lang.illegalargumentexception: can't find common super class of [com/loopj/android/http/mysslsocketfactory] (with 1 known super classes) , [java/security/keystore] (with 2 known super classes)
proguard-rules.pro
-optimizationpasses 5 -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -dontskipnonpubliclibraryclassmembers -dontpreverify -verbose -dump class_files.txt -printseeds seeds.txt -printusage unused.txt -printmapping mapping.txt -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* -allowaccessmodification -keepattributes *annotation* -renamesourcefileattribute sourcefile -keepattributes sourcefile,linenumbertable -repackageclasses '' #---------------test -dontwarn javax.annotation.** -keep class com.google.** -dontwarn com.google.** -keep class com.conviva.** -dontwarn com.conviva.** -keep class com.loopj.android.http.** -keep class org.apache.http.** -keep class rx.internal.util.** -keep class com.algolia.search.** -dontwarn com.loopj.android.http.** -dontwarn org.apache.http.** -dontwarn rx.internal.util.** -dontwarn com.algolia.search.** -keep public class android.net.http.sslerror -keep public class android.webkit.webviewclient -dontwarn android.webkit.webview -dontwarn android.net.http.sslerror -dontwarn android.webkit.webviewclient -keep class com.loopj.android.** { *; } -keep interface com.loopj.android.** { *; } -assumenosideeffects class android.util.log { public static boolean isloggable(java.lang.string, int); public static int v(...); public static int i(...); public static int w(...); public static int d(...); public static int e(...); } #---------------test -keep public class * extends android.app.activity -keep public class * extends android.app.application -keep public class * extends android.app.service -keep public class * extends android.content.broadcastreceiver -keep public class * extends android.content.contentprovider -keep public class * extends android.app.backup.backupagenthelper -keep public class * extends android.preference.preference -keep public class com.android.vending.licensing.ilicensingservice -dontnote com.android.vending.licensing.ilicensingservice # explicitly preserve serialization members. serializable interface # marker interface, wouldn't save them. -keepclassmembers class * implements java.io.serializable { static final long serialversionuid; private static final java.io.objectstreamfield[] serialpersistentfields; private void writeobject(java.io.objectoutputstream); private void readobject(java.io.objectinputstream); java.lang.object writereplace(); java.lang.object readresolve(); } # preserve native method names , names of classes. -keepclasseswithmembernames class * { native <methods>; } -keepclasseswithmembernames class * { public <init>(android.content.context, android.util.attributeset); } -keepclasseswithmembernames class * { public <init>(android.content.context, android.util.attributeset, int); } # preserve static fields of inner classes of r classes might accessed # through introspection. -keepclassmembers class **.r$* { public static <fields>; } # preserve special static methods required in enumeration classes. -keepclassmembers enum * { public static **[] values(); public static ** valueof(java.lang.string); } -keep public class * { public protected *; } -keep class * implements android.os.parcelable { public static final android.os.parcelable$creator *; } ##---------------end: proguard configuration common android apps ---------- #---------------begin: proguard configuration support library ---------- -keep class android.support.v4.app.** { *; } -keep interface android.support.v4.app.** { *; } -keep class com.actionbarsherlock.** { *; } -keep interface com.actionbarsherlock.** { *; } # support library contains references newer platform versions. # don't warn in case app linking against older # platform version. know them, , safe. -dontwarn android.support.** -dontwarn com.google.ads.** ##---------------end: proguard configuration gson ---------- ##---------------begin: proguard configuration gson ---------- # gson uses generic type information stored in class file when working fields. proguard # removes such information default, configure keep of it. -keepattributes signature # using gson @expose annotation -keepattributes *annotation* # gson specific classes -keep class sun.misc.unsafe { *; } #-keep class com.google.gson.stream.** { *; } # application classes serialized/deserialized on gson -keep class com.example.model.** { *; } ##---------------end: proguard configuration gson ---------- # if project uses webview js, uncomment following # , specify qualified class name javascript interface # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #}
gradle
android { compilesdkversion 25 buildtoolsversion "24.0.3" uselibrary 'org.apache.http.legacy' }
edit
this how enabling pro-guard in app
build.gralde
file, using 'proguard-android-optimize.txt
buildtypes { release { minifyenabled true shrinkresources true proguardfiles getdefaultproguardfile('proguard-android-optimize.txt'), 'proguard-rules.pro' } }
add this:
-keep class cz.msebera.android.httpclient.** { *; } -dontwarn cz.msebera.android.httpclient.**
update: try this:
-keep class com.loopj.android.** { *; } -keep interface com.loopj.android.** { *; } -keep class cz.msebera.android.** { *; } -keep interface cz.msebera.android.** { *; } -dontwarn cz.msebera.android.** -dontwarn com.loopj.android.**
Comments
Post a Comment