2016-06-02 17 views
0

Ich aktiviert Progard, um den Code meiner Anwendung zu verschleiern. Insbesondere würde ich nur die Aktivität der Anwendung verdecken, aber ich bekomme viele Fehler bei der Erstellung der APK. Dieser Fehler tritt auch auf, wenn in Programmierbibliotheken ein Progress True gesetzt ist. Kann mir jemand helfen ?Android Studio Proguard Fehler

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' 
} 

Fehler:

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. 

Antwort

2

Wie die Fehlermeldung schon sagt, wenn die App ok läuft, können Sie verwenden --dontwarn, etc in Ihrer proguard Datei. Gefällt mir:

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

Wenn Sie Probleme haben, müssen Sie ein wenig in warum warum eintauchen.

Zum Beispiel, wie es optimiert ist, usw.

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

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

Hier ist eine Android-Referenz: https://developer.android.com/studio/build/shrink-code.html

Viele Bibliotheken haben auch die proguard Informationen für ihre Bibliothek, die am nützlichsten ist.

Verwandte Themen