设置minifyEnabled时的警告为混淆代码

时间:2018-03-21 18:06:15

标签: android obfuscation

这是我的依赖树,我试图在proguard-rules.pro文件中添加一些规则,但它只会禁用警告,而某些库在应用程序内部无效。就像帮助我创建安全首选项文件的Qlassified Library一样。

构建产生1000多个警告和1个错误,太大而无法粘贴到此处,因此上传到pastebin BuildResults

任何帮助都会被贬低,谢谢

这是在我的proguard-rules.pro档案

-keep class com.avanz.token.** { *; }
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose
-ignorewarnings
-keepclasseswithmembernames class * {
    native <methods>;
}
-keepclasseswithmembers class * {
    public <init>(android.content.context,  android.util.AttributeSet);
}

这些是我的依赖

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'

    defaultConfig {
        applicationId "com.avanz.token"
        minSdkVersion 19 //Android 4.4
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }
}

dependencies {
    implementation 'com.android.support:support-vector-drawable:26.1.0'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support:cardview-v7:26.1.0'
    compile 'com.android.support:recyclerview-v7:26.1.0'
    compile 'com.android.support:design:26.1.0'
    compile 'com.android.support:support-v4:26.1.0'
    compile 'com.android.support:support-annotations:26.1.0'
    compile 'commons-codec:commons-codec:1.11'
    compile 'com.android.support:multidex:1.0.2'

    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.balysv:material-ripple:1.0.2'
    compile 'com.afollestad.material-dialogs:core:0.9.4.5'
    compile 'ir.bpadashi.requester:requester:1.1.3'
    compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.2'
    compile 'com.dinuscxj:circleprogressbar:1.1.1'
    compile 'com.jaredrummler:android-device-names:1.1.5'
    compile 'uk.co.chrisjenx:calligraphy:2.3.0'
    compile 'com.q42:qlassified:0.1.1'
    compile 'com.mtramin:rxfingerprint:2.2.1'
    compile 'io.reactivex.rxjava2:rxjava:2.1.1'
    compile('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
        transitive = true;
    }
}

这是我的proguard-rules.pro文件

# The following line may be different


-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
# (3)Not remove unused code
-dontshrink

-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
# (2)Simple XML
-keep public class com.bea.xml.stream.**{ *; }
-keep class com.bea.xml.stream.AtrributeBase**{ *; }
-keep class com.bea.xml.stream.EventFactory**{ *; }
-keep class com.bea.xml.stream.EventReaderFilter**{ *; }
# (1)Annotations and signatures
-keepattributes *Annotation*
-keepattributes Signature
#Crashlytics
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**
#Qlassified
-keep class com.q42.qlassified.** { *; }
-dontwarn com.q42.qlassified.**
#Okhttp
-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

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers class * extends android.app.Activity {
   public void *(android.view.View);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

0 个答案:

没有答案