Proguard and error

后端 未结 4 964
甜味超标
甜味超标 2020-12-06 10:22

I use this proguard file:

 -dontskipnonpubliclibraryclasses
 -dontskipnonpubliclibraryclassmembers

 !code/simplification/arithmetic,!code/simplification/cas         


        
相关标签:
4条回答
  • 2020-12-06 10:34

    It looks like the warning comes from the google library, have you tried something like that:

    -dontwarn com.google.android.gms.**
    -keep class com.google.android.gms.**
    

    I would also try without the dontwarn cause I would assume you want to be warned if there is something to be warned about!

    0 讨论(0)
  • 2020-12-06 10:42

    In Eclipse find org.apache.http.legacy.jar in ..sdk/platforms/android-23/optional.

    Import it like external jar, check order/export and in proguard type:

    -keep class org.apache.http.** { *; }
    -keepclassmembers class org.apache.http.** {*;}
    -dontwarn org.apache.**
    
    -keep class android.net.http.** { *; }
    -keepclassmembers class android.net.http.** {*;}
    -dontwarn android.net.**
    
    0 讨论(0)
  • 2020-12-06 10:47

    Add following lines in your proguard file.

    -keep class org.apache.http.** { *; }
    -keep class org.apache.** { *; }
    -dontwarn org.apache.**
    -dontwarn org.apache.http.**
    -dontwarn org.apache.commons.**
    
    0 讨论(0)
  • 2020-12-06 10:50

    I had the same problem.

    I found the answer here and it worked for me: How to add Apache HTTP API (legacy) as compile-time dependency to build.grade?

    In your top level build.gradle file add:

    buildscript {
        ...
        dependencies {
            classpath 'com.android.tools.build:gradle:1.3.1'
        }
    }
    ...
    

    In your app-specific build.gradle file add:

    android {
        compileSdkVersion 23
        buildToolsVersion "23.0.0"
        useLibrary 'org.apache.http.legacy'
        ...
    }
    

    Hope it works for you! it works now with ProGuard on. I had the exact same problem as you.

    0 讨论(0)
提交回复
热议问题