Правила ProGuard для msgpack-jackson, конвертера Retrofit2 MsgPack и адаптера вызова Retrofit2 RxJava2 - PullRequest
0 голосов
/ 10 сентября 2018

Я учился выпускать подписанный APK. Я нашел ресурсы для добавления правил ProGuard для большинства библиотек. Но за несколько человек я ничего не смог найти. Можете ли вы поделиться правилами ProGuard для

  1. MsgPack-Jackson
  2. Retrofit2-MsgPack-конвертер
  3. Retrofit2-RxJava2-Call-адаптер

Если это поможет, я прикрепил раздел зависимостей в правилах Gradle и ProGuard

implementation fileTree(include: ['*.jar'], dir: 'libs')

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:exifinterface:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation 'junit:junit:4.12'

implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0'
implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'

implementation 'org.msgpack:msgpack-core:0.8.16'

implementation 'org.altbeacon:android-beacon-library:2.15.1'

implementation 'com.github.bumptech.glide:glide:4.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'

implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'org.komamitsu:retrofit-converter-msgpack:1.1.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'

implementation 'org.greenrobot:eventbus:3.1.1'

implementation 'com.evernote:android-job:1.2.6'

implementation 'io.reactivex.rxjava2:rxjava:2.2.1'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'

И правила ProGuard

-keep class com.evernote.** { *; }

-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(...);
    public static int wtf(...);
}

#Retrofit2
# Retrofit does reflection on generic parameters and InnerClass is required to use Signature.
-keepattributes Signature, InnerClasses
# Retain service method parameters when optimizing.
-keepclassmembers,allowshrinking,allowobfuscation interface * {
    @retrofit2.http.* <methods>;
}
#Do not obfuscate the Models and Retrofit API interfaces
-keep class com.me.data.** { *; }
-keep interface com.me.data.** { *; }
# Ignore annotation used for build tooling.
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
# Ignore JSR 305 annotations for embedding nullability information.
-dontwarn javax.annotation.**
# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath.
-dontwarn kotlin.Unit
#Retrofit-MsgPack-Converter
-keep class org.komamitsu.** { *; }
-keep interface org.komamitsu.** { *; }
#Jackson Databind used in Retrofit-MsgPack-Converter
-keep @com.fasterxml.jackson.annotation.JsonIgnoreProperties class * { *; }
-keep @com.fasterxml.jackson.annotation.JsonCreator class * { *; }
-keep @com.fasterxml.jackson.annotation.JsonValue class * { *; }
-keep class com.fasterxml.** { *; }
-keep class org.codehaus.** { *; }
-keepnames class com.fasterxml.jackson.** { *; }
-keepclassmembers public final enum com.fasterxml.jackson.annotation.JsonAutoDetect$Visibility {
    public static final com.fasterxml.jackson.annotation.JsonAutoDetect$Visibility *;
}
-keepattributes SourceFile,LineNumberTable,*Annotation*,EnclosingMethod,Signature,Exceptions,InnerClasses
-dontwarn com.fasterxml.jackson.databind.**
-keepclassmembers class * {
     @com.fasterxml.jackson.annotation.* *;
}

#OkHttp3
-dontwarn okhttp3.**
-dontwarn okio.**
-dontwarn javax.annotation.**
-dontwarn org.conscrypt.**
#A resource is loaded with a relative path so the package of this class must   be preserved.
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase

#Greenrobot's EventBus
-keepattributes *Annotation*
-keepclassmembers class * {
    @org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }

#Glide
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.module.AppGlideModule
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
  **[] $VALUES;
  public *;
}

#AltBeacon: Obfuscation is applied automatically
#-dontwarn org.altbeacon.**
#-keep class org.altbeacon.** { *; }
#-keep interface org.altbeacon.** { *; }

#MsgPack
-keep class org.msgpack.** { *; }
-keep interface org.msgpack.** { *; }

#Paho
-keep class org.eclipse.paho.** { *; }
-keep interface org.eclipse.paho.** { *; }
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...