繁体   English   中英

Android Studio Proguard错误

[英]Android studio proguard error

我启用了Proguard来混淆我的应用程序的代码。 具体来说,我只会掩盖应用程序的活动,但是在创建APK时会遇到很多错误。 如果在库中强制设置为true,也会出现此错误。 谁能帮我 ?

    apply plugin: 'com.android.application'    

android {         
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    defaultConfig {
        applicationId "my.packname"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 52
        versionName "2.0.2"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile files('libs/commons-codec-1.8.jar')
    compile files('libs/dropbox-android-sdk-1.6.3.jar')
    compile files('libs/httpmime-4.0.3.jar')
    compile files('libs/json_simple-1.1.jar')
    compile files('libs/pass-v1.2.1.jar')
    compile files('libs/sdk-v1.0.0.jar')    
    compile project(':library_edittext')
    compile project(':aFileChooser')
    compile project(':library_color_picker')
    compile project(':sqlcipher-for-android')
    compile project(':library_menu_main')
    compile 'io.reactivex:rxjava:1.0.10'    
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:support-v4:23.1.1'
    compile 'com.android.support:design:23.1.1'
 }

错误:

 Warning:there were 87 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: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.

     Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
    > java.io.IOException: Please correct the above warnings first.

如错误消息所示,如果应用程序运行正常,则可以在proguard文件中使用--dontwarn等。 像这样:

-dontwarn android.support.**
-dontnote android.support.**

如果遇到问题,则必须深入研究原因。

例如,如何对其进行优化等。

-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*,!code/allocation/variable

-keepparameternames
-keepattributes Signature,Exceptions,InnerClasses,Deprecated,
                SourceFile,LineNumberTable,EnclosingMethod,
                *Annotation*

这是一个android参考: https : //developer.android.com/studio/build/shrink-code.html

许多图书馆也为他们的图书馆提供了proguard信息,这是最有用的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM