启用Proguard时出错

时间:2016-06-02 12:52:26

标签: android proguard android-proguard

我在我的根目录中使用了Proguard的自定义文件。

文件名:

Users/developers/Library/Android/sdk/tools/proguard/

我刚从

复制了默认文件
buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.21.5'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

defaultConfig {
    applicationId "com.cus.main"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 18
    versionName "v0.9.4"
    multiDexEnabled true
}

dataBinding {
    enabled = true
}

dexOptions {
    javaMaxHeapSize "4g"
    incremental true
}

buildTypes {
    release {
        debuggable false
        shrinkResources false
        minifyEnabled true
        proguardFile 'cus-proguard-android.txt'
        proguardFile 'proguard-rules.pro'
        buildConfigField "String", "HOST", "$host_release"
    }

    development.initWith(buildTypes.debug)
    development {
        buildConfigField "String", "HOST", "$host_development"
    }

    preprod.initWith(buildTypes.debug)
    preprod {
        buildConfigField "String", "HOST", "$host_preprod"
    }

    feature.initWith(buildTypes.debug)
    feature {
        buildConfigField "String", "HOST", "$host_feature"
    }

    production {
        debuggable false
        shrinkResources false
        minifyEnabled true
        proguardFile 'cus-proguard-android.txt'
        proguardFile 'proguard-rules.pro'
        buildConfigField "String", "HOST", "$host_production"
    }
}


sourceSets {
    main {

        assets.srcDirs = ['src/main/assets', 'src/main/assets/', 'src/main/assets/fonts']


}
}

repositories {
mavenCentral()
mavenLocal()
flatDir {
    dirs 'libs'
}
maven { url 'https://maven.fabric.io/public' }
}



dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
//compile 'com.citrus.sdk:payment-sdk:3.0.27'
// Crashlytics
compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') {
    transitive = true;
}
// Support Libraries
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:gridlayout-v7:23.4.0'

// ViewPagerIndicator
compile 'com.mcxiaoke.viewpagerindicator:library:2.4.1@aar'

// Gif Drawable
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.9'

// Network Layer
compile 'com.squareup.retrofit2:retrofit:2.0.0'
compile 'com.google.code.gson:gson:2.4'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
compile 'com.squareup.okhttp:okhttp:2.5.0'

// Event Bus
compile 'com.squareup:otto:1.3.8'

// Image rendering
compile 'com.squareup.picasso:picasso:2.5.2'

// Sliding Up Panel
compile 'com.sothree.slidinguppanel:library:3.2.0'

// Google
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services:8.4.0'

// Parse
compile 'com.parse.bolts:bolts-android:1.3.0'
compile 'com.parse:parse-android:1.11.0'

// Analytics
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.mixpanel.android:mixpanel-android:4.8.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'

// Custom Fonts
compile 'uk.co.chrisjenx:calligraphy:2.1.0'

// Custom Layout for recyclerview
compile 'org.solovyev.android.views:linear-layout-manager:0.5@aar'
}

apply plugin: 'com.google.gms.google-services'

gradle.build文件:

# Retrofit
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Signature

-keepattributes Exceptions

-keepclasseswithmembers class * {
@retrofit2.http.* <methods>;
}

-keep class com.ample.main.model.** { *; }
-keep class com.ample.main.viewmodel.** { *; }

#okhttp
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.*

-keep class com.google.gson.** { *; }
-keep class com.google.inject.** { *; }
-keep class org.apache.http.** { *; }
-keep class org.apache.james.mime4j.** { *; }
-keep class javax.inject.** { *; }

# Parse
-keep class com.parse.** { *; }
-dontwarn com.parse.**
-keepattributes SourceFile,LineNumberTable
-keepnames class com.parse.** { *; }
-dontwarn com.squareup.**
-dontwarn android.net.SSLCertificateSocketFactory
-dontwarn android.app.Notification
-keep class bolts.** { *; }
-keepnames class bolts.** { *; }

# okio
-dontwarn okio.**
-keep class sun.misc.Unsafe { *; }
-dontwarn java.nio.file.*
-dontwarn java.nio.file.Path
-dontwarn java.nio.file.OpenOption
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

-dontwarn com.squareup.okhttp.**

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

# razorpay
-keepclassmembers class * {
@android.webkit.JavascriptInterface <methods>;
}

-keepattributes JavascriptInterface

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

-optimizations !method/inlining/*


-dontnote android.net.http.*
-dontnote org.apache.commons.codec.**
-dontnote org.apache.http.**
-keep public class com.android.vending.licensing.ILicensingService

-dontwarn android.support.v7.**
-keep class android.support.v7.** { *; }
-keep interface android.support.v7.** { *; }

-keepattributes InnerClasses
-keepattributes EnclosingMethod

# otto ( square )
-keepclassmembers class ** {
@com.squareup.otto.Subscribe public *;
@com.squareup.otto.Produce public *;
}

#gif drawable
-keep public class pl.droidsonroids.gif.GifIOException{<init>(int);}
-keep class pl.droidsonroids.gif.GifInfoHandle{<init>   (long,int,int,int);}

# calligraphy
-keep class uk.co.chrisjenx.calligraphy.* { *; }
-keep class uk.co.chrisjenx.calligraphy.*$* { *; }

# google analytics
-keep class com.google.analytics.** { *; }


# facebook
-keep class com.facebook.** { *; }

# crashlytics
-keep public class * extends java.lang.Exception
-keep class com.crashlytics.** { *; }
-dontwarn com.crashlytics.**
-dontwarn com.google.appengine.api.urlfetch.**
# If you are using custom exceptions, add this line so that custom     exception types are skipped during obfuscation:
-keep public class * extends java.lang.Exception

# For Fabric to properly de-obfuscate your crash reports, you need to remove this line from your ProGuard config:
-printmapping mapping.txt


#android.support.v4
-dontwarn android.support.v4.**

-dontwarn org.androidannotations.api.rest.**

# google analytics
-keep class com.google.analytics.** { *; }

# google play service
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}

-keep public class    com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
 @com.google.android.gms.common.annotation.KeepName *;
}

 -keepnames class * implements android.os.Parcelable {
 public static final ** CREATOR;

我的proguard-rules.pro文件是

Note: the configuration keeps the entry point 'okhttp3.RequestBody$3 {     void writeTo(okio.BufferedSink); }', but not the descriptor class  'okio.BufferedSink'
Note: the configuration keeps the entry point 'okhttp3.ResponseBody { okhttp3.ResponseBody create(okhttp3.MediaType,long,okio.BufferedSource); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.ResponseBody$1 { ResponseBody$1(okhttp3.MediaType,long,okio.BufferedSource); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.DiskLruCache$2 { DiskLruCache$2(okhttp3.internal.DiskLruCache,okio.Sink); }', but not the descriptor class 'okio.Sink'
Note: the configuration keeps the entry point 'okhttp3.internal.DiskLruCache$4 { void write(okio.Buffer,long); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point  'okhttp3.internal.DiskLruCache$Editor$1 {   DiskLruCache$Editor$1(okhttp3.internal.DiskLruCache$Editor,okio.Sink); }', but not the descriptor class 'okio.Sink'
Note: the configuration keeps the entry point 'okhttp3.internal.DiskLruCache$Entry { void writeLengths(okio.BufferedSink); }', but not the descriptor class 'okio.BufferedSink'
Note: the configuration keeps the entry point 'okhttp3.internal.DiskLruCache$Snapshot { DiskLruCache$Snapshot(okhttp3.internal.DiskLruCache,java.lang.String,long,okio.Source[],long[]); }', but not the descriptor class 'okio.Source'
Note: the configuration keeps the entry point 'okhttp3.internal.DiskLruCache$Snapshot { DiskLruCache$Snapshot(okhttp3.internal.DiskLruCache,java.lang.String,long,okio.Source[],long[],okhttp3.internal.DiskLruCache$1); }', but not the descriptor class 'okio.Source'
Note: the configuration keeps the entry point 'okhttp3.internal.FaultHidingSink { FaultHidingSink(okio.Sink); }', but not the descriptor class 'okio.Sink'
Note: the configuration keeps the entry point 'okhttp3.internal.FaultHidingSink { void write(okio.Buffer,long); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.Util { boolean discard(okio.Source,int,java.util.concurrent.TimeUnit); }', but not the descriptor class 'okio.Source'
Note: the configuration keeps the entry point 'okhttp3.internal.Util { boolean skipAll(okio.Source,int,java.util.concurrent.TimeUnit); }', but not the descriptor class 'okio.Source'
Note: the configuration keeps the entry point 'okhttp3.internal.Util { okio.ByteString sha1(okio.ByteString); }', but not the descriptor class 'okio.ByteString'
Note: the configuration keeps the entry point 'okhttp3.internal.Util { okio.ByteString sha256(okio.ByteString); }', but not the descriptor class 'okio.ByteString'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.FrameReader$Handler { void data(boolean,int,okio.BufferedSource,int); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.FrameReader$Handler { void goAway(int,okhttp3.internal.framed.ErrorCode,okio.ByteString); }', but not the descriptor class 'okio.ByteString'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.FrameReader$Handler { void alternateService(int,java.lang.String,okio.ByteString,java.lang.String,int,long); }', but not the descriptor class 'okio.ByteString'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.FrameWriter { void data(boolean,int,okio.Buffer,int); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.FramedConnection { void writeData(int,boolean,okio.Buffer,long); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.FramedConnection { void pushDataLater(int,okio.BufferedSource,int,boolean); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.FramedConnection { void access$1400(okhttp3.internal.framed.FramedConnection,int,okio.BufferedSource,int,boolean); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.FramedConnection$6 { FramedConnection$6(okhttp3.internal.framed.FramedConnection,java.lang.String,java.lang.Object[],int,okio.Buffer,int,boolean); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.FramedConnection$Builder { okhttp3.internal.framed.FramedConnection$Builder socket(java.net.Socket,java.lang.String,okio.BufferedSource,okio.BufferedSink); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.FramedConnection$Builder { okhttp3.internal.framed.FramedConnection$Builder socket(java.net.Socket,java.lang.String,okio.BufferedSource,okio.BufferedSink); }', but not the descriptor class 'okio.BufferedSink'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.FramedConnection$Reader { void data(boolean,int,okio.BufferedSource,int); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.FramedConnection$Reader { void goAway(int,okhttp3.internal.framed.ErrorCode,okio.ByteString); }', but not the descriptor class 'okio.ByteString'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.FramedConnection$Reader { void alternateService(int,java.lang.String,okio.ByteString,java.lang.String,int,long); }', but not the descriptor class 'okio.ByteString'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.FramedStream { void receiveData(okio.BufferedSource,int); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.FramedStream$FramedDataSink { void write(okio.Buffer,long); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.FramedStream$FramedDataSource { long read(okio.Buffer,long); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.FramedStream$FramedDataSource { void receive(okio.BufferedSource,long); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Header { Header(okio.ByteString,java.lang.String); }', but not the descriptor class 'okio.ByteString'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Header { Header(okio.ByteString,okio.ByteString); }', but not the descriptor class 'okio.ByteString'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Header { Header(okio.ByteString,okio.ByteString); }', but not the descriptor class 'okio.ByteString'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Hpack { okio.ByteString checkLowercase(okio.ByteString); }', but not the descriptor class 'okio.ByteString'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Hpack { okio.ByteString access$100(okio.ByteString); }', but not the descriptor class 'okio.ByteString'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Hpack$Reader { Hpack$Reader(int,okio.Source); }', but not the descriptor class 'okio.Source'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Hpack$Writer { Hpack$Writer(okio.Buffer); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Hpack$Writer { void writeByteString(okio.ByteString); }', but not the descriptor class 'okio.ByteString'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Http2 { okhttp3.internal.framed.FrameReader newReader(okio.BufferedSource,boolean); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Http2 { okhttp3.internal.framed.FrameWriter newWriter(okio.BufferedSink,boolean); }', but not the descriptor class 'okio.BufferedSink'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Http2 { int readMedium(okio.BufferedSource); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Http2 { void writeMedium(okio.BufferedSink,int); }', but not the descriptor class 'okio.BufferedSink'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Http2 { int access$300(okio.BufferedSource); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Http2 { void access$600(okio.BufferedSink,int); }', but not the descriptor class 'okio.BufferedSink'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Http2$ContinuationSource { Http2$ContinuationSource(okio.BufferedSource); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Http2$ContinuationSource { long read(okio.Buffer,long); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Http2$Reader { Http2$Reader(okio.BufferedSource,int,boolean); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Http2$Writer { Http2$Writer(okio.BufferedSink,boolean); }', but not the descriptor class 'okio.BufferedSink'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Http2$Writer { void data(boolean,int,okio.Buffer,int); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Http2$Writer { void dataFrame(int,byte,okio.Buffer,int); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.NameValueBlockReader {  NameValueBlockReader(okio.BufferedSource); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.NameValueBlockReader$1 { NameValueBlockReader$1(okhttp3.internal.framed.NameValueBlockReader,okio.Source); }', but not the descriptor class 'okio.Source'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.NameValueBlockReader$1 { long read(okio.Buffer,long); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.PushObserver { boolean onData(int,okio.BufferedSource,int,boolean); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.PushObserver$1 { boolean onData(int,okio.BufferedSource,int,boolean); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Spdy3 { okhttp3.internal.framed.FrameReader newReader(okio.BufferedSource,boolean); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Spdy3 { okhttp3.internal.framed.FrameWriter newWriter(okio.BufferedSink,boolean); }', but not the descriptor class 'okio.BufferedSink'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Spdy3$Reader { Spdy3$Reader(okio.BufferedSource,boolean); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Spdy3$Writer { Spdy3$Writer(okio.BufferedSink,boolean); }', but not the descriptor class 'okio.BufferedSink'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Spdy3$Writer { void data(boolean,int,okio.Buffer,int); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Spdy3$Writer { void sendDataFrame(int,int,okio.Buffer,int); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Variant { okhttp3.internal.framed.FrameReader newReader(okio.BufferedSource,boolean); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.framed.Variant { okhttp3.internal.framed.FrameWriter newWriter(okio.BufferedSink,boolean); }', but not the descriptor class 'okio.BufferedSink'
Note: the configuration keeps the entry point 'okhttp3.internal.http.Http1xStream { Http1xStream(okhttp3.internal.http.StreamAllocation,okio.BufferedSource,okio.BufferedSink); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.http.Http1xStream { Http1xStream(okhttp3.internal.http.StreamAllocation,okio.BufferedSource,okio.BufferedSink); }', but not the descriptor class 'okio.BufferedSink'
Note: the configuration keeps the entry point 'okhttp3.internal.http.Http1xStream { void detachTimeout(okio.ForwardingTimeout); }', but not the descriptor class 'okio.ForwardingTimeout'
Note: the configuration keeps the entry point 'okhttp3.internal.http.Http1xStream { void access$400(okhttp3.internal.http.Http1xStream,okio.ForwardingTimeout); }', but not the descriptor class 'okio.ForwardingTimeout'
Note: the configuration keeps the entry point 'okhttp3.internal.http.Http1xStream$ChunkedSink { void write(okio.Buffer,long); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.http.Http1xStream$ChunkedSource { long read(okio.Buffer,long); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.http.Http1xStream$FixedLengthSink { void write(okio.Buffer,long); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.http.Http1xStream$FixedLengthSource { long read(okio.Buffer,long); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.http.Http1xStream$UnknownLengthSource { long read(okio.Buffer,long); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.http.Http2xStream$StreamFinishingSource { Http2xStream$StreamFinishingSource(okhttp3.internal.http.Http2xStream,okio.Source); }', but not the descriptor class 'okio.Source'
Note: the configuration keeps the entry point 'okhttp3.internal.http.HttpEngine { okhttp3.internal.http.HttpEngine recover(java.io.IOException,okio.Sink); }', but not the descriptor class 'okio.Sink' 
Note: the configuration keeps the entry point 'okhttp3.internal.http.HttpEngine$2 { HttpEngine$2(okhttp3.internal.http.HttpEngine,okio.BufferedSource,okhttp3.internal.http.CacheRequest,okio.BufferedSink); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.http.HttpEngine$2 { HttpEngine$2(okhttp3.internal.http.HttpEngine,okio.BufferedSource,okhttp3.internal.http.CacheRequest,okio.BufferedSink); }', but not the descriptor class 'okio.BufferedSink'
Note: the configuration keeps the entry point 'okhttp3.internal.http.HttpEngine$2 { long read(okio.Buffer,long); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.http.RealResponseBody { RealResponseBody(okhttp3.Headers,okio.BufferedSource); }', but not the descriptor class 'okio.BufferedSource'
Note: the configuration keeps the entry point 'okhttp3.internal.http.RetryableSink { void write(okio.Buffer,long); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okhttp3.internal.http.RetryableSink { void writeToSocket(okio.Sink); }', but not the descriptor class 'okio.Sink'
Note: the configuration keeps the entry point 'okhttp3.internal.http.StreamAllocation { boolean recover(java.io.IOException,okio.Sink); }', but not the descriptor class 'okio.Sink'
Note: the configuration keeps the entry point 'okio.AsyncTimeout { void scheduleTimeout(okio.AsyncTimeout,long,boolean); }', but not the descriptor class 'okio.AsyncTimeout'
Note: the configuration keeps the entry point 'okio.AsyncTimeout { boolean cancelScheduledTimeout(okio.AsyncTimeout); }', but not the descriptor class 'okio.AsyncTimeout'
Note: the configuration keeps the entry point 'okio.AsyncTimeout { okio.Sink sink(okio.Sink); }', but not the descriptor class 'okio.Sink'
Note: the configuration keeps the entry point 'okio.AsyncTimeout { okio.Source source(okio.Source); }', but not the descriptor class 'okio.Source'
Note: the configuration keeps the entry point 'okio.ForwardingSink { ForwardingSink(okio.Sink); }', but not the descriptor class 'okio.Sink'
Note: the configuration keeps the entry point 'okio.ForwardingSink { void write(okio.Buffer,long); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'okio.ForwardingSource { ForwardingSource(okio.Source); }', but not the descriptor class 'okio.Source'
Note: the configuration keeps the entry point 'okio.ForwardingSource { long read(okio.Buffer,long); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'pl.droidsonroids.gif.GifTextureView { void setInputSource(pl.droidsonroids.gif.InputSource); }', but not the descriptor class 'pl.droidsonroids.gif.InputSource'
Note: the configuration keeps the entry point 'retrofit2.OkHttpCall$ExceptionCatchingRequestBody$1 { OkHttpCall$ExceptionCatchingRequestBody$1(retrofit2.OkHttpCall$ExceptionCatchingRequestBody,okio.Source); }', but not the descriptor class 'okio.Source'
Note: the configuration keeps the entry point 'retrofit2.OkHttpCall$ExceptionCatchingRequestBody$1 { long read(okio.Buffer,long); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'retrofit2.RequestBuilder { void canonicalizeForPath(okio.Buffer,java.lang.String,int,int,boolean); }', but not the descriptor class 'okio.Buffer'
Note: the configuration keeps the entry point 'retrofit2.RequestBuilder$ContentTypeOverridingRequestBody { void writeTo(okio.BufferedSink); }', but not the descriptor class 'okio.BufferedSink'
Note: there were 6 references to unknown classes.
  You should check your configuration for typos.
    (http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
Note: there were 646 unkept descriptor classes in kept class members.
  You should consider explicitly keeping the mentioned classes
  (using '-keep').
   (http://proguard.sourceforge.net/manual/troubleshooting.html#descriptorclass)
Note: there were 26 unresolved dynamic references to classes or interfaces.
  You should check if you need to specify additional program jars.
  (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
Warning:there were 8 unresolved references to classes or interfaces.
     You may need to add missing library jars or update their versions.
     If your code works fine without the missing classes, you can suppress
     the warnings with '-dontwarn' options.
     (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning:there were 2 unresolved references to library class members.
     You probably need to update the library versions.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibr aryclassmember)
 Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
:app:transformClassesAndResourcesWithProguardForRelease FAILED
Error:Execution failed for task    ':app:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Please correct the above warnings first.

错误日志:

int x=65;
char ch{x};

2 个答案:

答案 0 :(得分:7)

您的错误日志似乎不包含所有警告。

要删除记事消息,您需要添加以下内容:

-dontnote okhttp3.**, okio.**, retrofit2.**, pl.droidsonroids.**

之后应该有更多的警告你需要处理。 要完全忽略警告并继续处理,请将以下内容添加到您的配置中:

-ignorewarnings

答案 1 :(得分:1)

为什么要为Proguard设置规则,默认配置是否会给您带来任何错误?无论如何,请查看此链接以获取有关Proguard

的详细信息

https://gist.github.com/albinmathew/c4436f8371c9c41461ab https://gist.github.com/Jackgris/c4a71328b1ae346cba04

默认配置意味着您只需输入

minifyEnabled true
useProguard true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 

通过这一行,Gradle使用默认的Proguard规则。

  

Dexguard(Proguard的商业版)

如果想让代码更安全,可以使用Dexguard。 Dexguard是Proguard的商业版本,因为dexguard带有字符串加密功能,可以使代码更安全。