Volley似乎与Proguard没有合作

时间:2016-09-29 16:21:51

标签: android android-volley proguard android-proguard

当我在发布版本中启用proguard时。 Volley能够提出请求但是在使用GSON进行解析时,似乎GSON无法正常工作。

以下是我的依赖项和proguard-rules.pro文件

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile project(':wheel-library')
    compile files('libs/YouTubeAndroidPlayerApi.jar')
    //    AWS Library dependencies
    compile files('libs/aws-android-sdk-s3-2.2.5.jar')
    compile files('libs/aws-android-sdk-cognito-2.2.5.jar')
    compile files('libs/aws-android-sdk-core-2.2.5.jar')

    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
    compile 'com.google.code.gson:gson:2.4'
    compile 'uk.co.chrisjenx:calligraphy:2.1.0'
    compile 'com.android.support:support-v4:23.4.0'
    compile 'com.android.support:cardview-v7:23.4.0'
    compile 'com.android.support:recyclerview-v7:23.4.0'
    compile 'com.google.android.gms:play-services-gcm:8.3.0'
    compile 'com.google.android.gms:play-services-analytics:8.3.0'
    compile 'com.google.guava:guava:19.0-rc2'
    compile 'com.android.support:design:23.4.0'
    compile 'com.viewpagerindicator:library:2.4.1@aar'
    compile 'com.android.support:support-v13:23.4.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.wefika:flowlayout:0.4.1'
    compile 'com.github.wangjiegulu:RapidFloatingActionButton:1.0.3'
    compile 'com.github.wangjiegulu:AndroidBucket:1.0.4'
    compile 'com.scottyab:secure-preferences-lib:0.1.4'

    // For Testing
    testCompile('org.powermock:powermock-api-mockito:1.6.2') {
        exclude module: 'hamcrest-core'
        exclude module: 'objenesis'
    }
    testCompile('org.powermock:powermock-module-junit4:1.6.2') {
        exclude module: 'hamcrest-core'
        exclude module: 'objenesis'
    }
    testCompile 'junit:junit:4.12'
    testCompile 'org.mockito:mockito-core:1.10.19'
}

# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/webonise/Android/Sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}

-keep class com.tozny.crypto.android.AesCbcWithIntegrity$PrngFixes$* { *; }
-ignorewarnings

##---------------Begin: proguard configuration for Gson  ----------
# Gson specific classes
-keep class sun.misc.Unsafe { *; }
#-keep class com.google.gson.stream.** { *; }

-keep class com.tigerworkshop.responses.** { *; }

##---------------End: proguard configuration for Gson  ----------

#volley
-keepclasseswithmembernames  interface com.android.volley.** { *; }
-keep class org.json.** {*;}
-keep class android.accounts.**{*;}
-keep class java.io.**{*;}
-keep class android.net.**{*;}
-keep class org.apache.http.**{*;}
-keep class android.net.http.AndroidHttpClient{*;}
-keep class com.android.volley.** {*;}
-keep class com.android.volley.toolbox.** {*;}
-keep class com.android.volley.Response$* { *; }
-keep class com.android.volley.Request$* { *; }
-keep class com.android.volley.RequestQueue$* { *; }
-keep class com.android.volley.toolbox.HurlStack$* { *; }
-keep class com.android.volley.toolbox.ImageLoader$* { *; }
-keep class org.apache.commons.logging.**

-dontwarn javax.management.**
-dontwarn java.lang.management.**
-dontwarn org.apache.log4j.**
-dontwarn org.apache.commons.logging.**
-dontwarn org.slf4j.**
-dontwarn org.json.**

#Toolbar
-keep class android.support.v4.** { *; }
-keep interface android.support.v4.** { *; }
-keep class android.support.v7.** { *; }
# Hide warnings about references to newer platforms in the library
-dontwarn android.support.v7.**
-keep interface android.support.v7.** { *; }
-keep class com.google.** { *; }
-keep class com.facebook.** { *; }
-keep class org.apache.** { *; }
-keep public class org.apache.commons.io.**

-keep class android.support.v7.internal.view.menu.** {*;}
-keep class android.support.v7.widget.SearchView {*;}
-keep class android.support.v7.widget.ActionMenuPresenter {*;}
-keep class android.support.v7.widget.ActionMenuView {*;}
-keep class android.support.v7.widget.Toolbar {*;}
-dontwarn
-ignorewarnings

-keep class android.widget.ArrayAdapter.** { *; }
#google map
 -keep class com.android.**
 -keep class com.google.android.**
 -keep class com.google.android.gms.**
 -keep class com.google.android.gms.location.**
 -keep class com.google.api.client.**
 -keep class com.google.maps.android.**


 # Allow obfuscation of android.support.v7.internal.view.menu.**
 # to avoid problem on Samsung 4.2.2 devices with appcompat v21
 # see https://code.google.com/p/android/issues/detail?id=78377

 -keep class !android.support.v7.internal.view.menu.**,android.support.** {*;}

我在互联网上尝试了很多解决方案。似乎没有什么工作。请帮忙。

0 个答案:

没有答案