Android Proguard不会混淆任何内容

时间:2018-09-30 03:46:07

标签: android proguard obfuscation

我已在我的gradle文件中启用了proguard。构建.apk之后,我仍然可以看到所有类以及这些类的实现。我花了数小时试图找出问题所在,但仍然找不到解决方案。是,我什么都没想?

buildTypes {
    release {
        debuggable = false
        jniDebuggable = false
        configurations.all {
            resolutionStrategy.force 'com.squareup:javawriter:2.1.1'
        }
        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

以下是我的proguard-rules.pro

-optimizationpasses 5
-allowaccessmodification
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers

-keepattributes Annotation
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
-repackageclasses 'o'
-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

-dontwarn android.support.**
-dontwarn android.arch.**

-dontwarn com.appsflyer.**
-keep class com.appsflyer.** { *; }

-dontwarn org.joda.time.**
-keep class org.joda.time.** { *; }

## -------------Begin: Retrofit2 ---
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes *Annotation*

-keepclasseswithmembers class * {
    @retrofit2.http.* <methods>;
}
-keepclassmembernames interface * {
        @retrofit.http.* <methods>;
}
-dontwarn retrofit2.Platform$Java8

0 个答案:

没有答案