Android:在生成标志apk期间获取此错误

时间:2017-08-14 10:11:38

标签: android gradle apk sign

我在生成签名APK时收到此错误。请帮帮我。

看到这个错误

    Information:Gradle tasks [:app:assembleRelease]
    Warning:com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl: can't find referenced method 'long getContentLengthLong()' in program class com.squareup.okhttp.internal.huc.HttpURLConnectionImpl
    Warning:com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl: can't find referenced method 'long getHeaderFieldLong(java.lang.String,long)' in program class com.squareup.okhttp.internal.huc.HttpURLConnectionImpl
    Warning:com.squareup.okhttp.internal.huc.JavaApiConverter$CacheHttpsURLConnection: can't find referenced method 'long getContentLengthLong()' in program class com.squareup.okhttp.internal.huc.JavaApiConverter$CacheHttpURLConnection
    Warning:com.squareup.okhttp.internal.huc.JavaApiConverter$CacheHttpsURLConnection: can't find referenced method 'long getHeaderFieldLong(java.lang.String,long)' in program class com.squareup.okhttp.internal.huc.JavaApiConverter$CacheHttpURLConnection
    Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced field 'com.squareup.okhttp.CacheControl FORCE_CACHE' in program class com.squareup.okhttp.CacheControl
    Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl$Builder
    Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced method 'com.squareup.okhttp.Request$Builder cacheControl(com.squareup.okhttp.CacheControl)' in program class com.squareup.okhttp.Request$Builder
    Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.CacheControl$Builder
    Warning:okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
    Warning:okio.Okio: can't find referenced class java.nio.file.Files
    Warning:okio.Okio: can't find referenced class java.nio.file.Path
    Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption
    Warning:okio.Okio: can't find referenced class java.nio.file.Path
    Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption
    Warning:okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
    Warning:okio.Okio: can't find referenced class java.nio.file.Path
    Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption
    Warning:okio.Okio: can't find referenced class java.nio.file.Path
    Warning:okio.Okio: can't find referenced class java.nio.file.OpenOption
    Warning:okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
    Warning:there were 21 unresolved references to classes or interfaces.
    Warning:there were 6 unresolved references to program class members.
    Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
    Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
    > Job failed, see logs for details
    Information:BUILD FAILED
    Information:Total time: 30.672 secs
    Information:1 error
    Information:23 warnings
    Information:See complete output in console

1 个答案:

答案 0 :(得分:0)

您需要添加此

如果您使用的是ProGuard,则可能需要添加以下选项:

-dontwarn com.squareup.okhttp.**

检查docs