【发布时间】:2018-06-05 18:41:56
【问题描述】:
当我将 Retrofit 2.4.0 库添加到 android 项目时 >
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
并设置 minifyEnabled {true}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
然后将这些规则添加到 proguard-rules.pro
-keep class com.squareup.** { *; }
-keep interface com.squareup.** { *; }
-keep class retrofit2.** { *; }
-keep interface retrofit2.** { *;}
-keep interface com.squareup.** { *; }
-keepclasseswithmembers class * {
@retrofit2.http.* <methods>;
}
-dontwarn rx.**
-dontwarn retrofit2.**
-dontwarn okhttp3.**
-dontwarn okio.**
最终成功构建并生成签名 apk,但问题是运行(发布 apk)> 改造请求未发送并返回 { null } .. 请问有什么解决办法!
【问题讨论】: