Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了android – 在android工作室中的proguard错误大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在我的应用程序中使用proguard,我启用它但是当我想生成apk文件时,它给了我这个错误
Information:Gradle tasks [:app:assembleRelease]
:app:preBuild UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
:app:checkReleaseManifest
:app:preDebugBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72300Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72300Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2300Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72300Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42300Library UP-TO-DATE
:app:prepareJpWasabeefRecyclerviewAnimators122Library UP-TO-DATE
:app:prepareReleaseDependencies
:app:compileReleaseAidl UP-TO-DATE
:app:compileReleaseRenderscript UP-TO-DATE
:app:generateReleaseBuildConfig UP-TO-DATE
:app:generateReleaseAssets UP-TO-DATE
:app:mergeReleaseAssets UP-TO-DATE
:app:generateReleaseResValues UP-TO-DATE
:app:generateRelease@R_944_5550@es UP-TO-DATE
:app:mergeRelease@R_944_5550@es UP-TO-DATE
:app:processReleaseManifest UP-TO-DATE
:app:processRelease@R_944_5550@es UP-TO-DATE
:app:generateReleasesources UP-TO-DATE
:app:processReleaseJavaRes UP-TO-DATE
:app:compileReleaseJava UP-TO-DATE
:app:compileReleaseNdk UP-TO-DATE
:app:compileReleasesources UP-TO-DATE
:app:lintVitalRelease
:app:proguardRelease
Note: there were 7 duplicate class deFinitions.
      (http://proguard.sourceforge.net/manual/troubleshooTing.html#duplicateclass)
Warning:library class org.apache.http.conn.scheR_709_11845@e.LayeredSocketFactory extends or implements program class org.apache.http.conn.scheR_709_11845@e.socketFactory
Warning:org.acra.ErrorReporter: can't find referenced method 'void setLatestEvenTinfo(android.content.Context,java.lang.CharSequence,android.app.pendingIntent)' in library class android.app.Notification
Warning:library class android.webkit.WebView depends on program class android.net.http.SslCertificate
Warning:library class org.apache.http.conn.ssl.SSLSocketFactory depends on program class org.apache.http.conn.scheR_709_11845@e.HostNameResolver
Warning:library class org.apache.http.conn.ssl.SSLSocketFactory depends on program class org.apache.http.params.httpParams
Warning:library class org.apache.http.params.httpconnectionParams depends on program class org.apache.http.params.httpParams
Warning:there were 17 instances of library classes depending on program classes.
         You must avoid such dependencies,since the program classes will
         be processed,while the library classes will remain unchanged.
         (http://proguard.sourceforge.net/manual/troubleshooTing.html#dependency)
Warning:there were 1 unresolved references to library class members.
         You probably need to update the library versions.
         (http://proguard.sourceforge.net/manual/troubleshooTing.html#unresolvedlibraryclassmember)
:app:proguardRelease Failed
Error:Execution Failed for task ':app:proguardRelease'.
> java.io.IOException: Please correct the above warnings first.

我正在使用最新版本的sdk 23,这是我的gradle文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.0'

    defaultConfig {
        applicationId "com.x.x"
        minSdkVersion 11
        targetSdkVersion 23
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.txt'
        }
    }
}



dependencies {
    compile 'com.android.support:appcompat-v7:23.0.0'
    compile 'com.android.support:recyclerview-v7:23.0.0'
    compile files('libs/acra-4.5.0.jar')
    compile files('libs/universal-image-loader-1.8.4-with-sources.jar')
    compile files('libs/org.apache.http.legacy.jar')
    compile 'com.android.support:cardview-v7:23.0.0'
    compile 'jp.wasabeef:recyclerview-animators:1.2.2'
    compile 'com.android.support:design:23.0.0'
}

怎么了 ?我在这代码中做错了什么?

谢谢

解决方法@H_404_14@
只需在proguard上添加
-keep class org.apache.http.** { *; }
-dontwarn org.apache.http.**
-dontwarn android.net.**

大佬总结

以上是大佬教程为你收集整理的android – 在android工作室中的proguard错误全部内容,希望文章能够帮你解决android – 在android工作室中的proguard错误所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。