我在proguard.rules
文件中添加了以下规则。
现在,当我从android-studio运行调试版本时,它正在工作,但是当我生成一个已签名的apk时,它会在Launch上崩溃。
#### -- Picasso --
-dontwarn com.squareup.okhttp.**
#### -- databinding --
-dontwarn android.databinding.**
#### -- Apache Commons --
-dontwarn org.apache.http.entity.**
以下是日志
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForQaRelease'.
Job failed, see logs for details
Warning:org.apache.http.entity.mime.content.StringBody: can't find referenced class org.apache.http.util.Args
Warning:org.apache.http.entity.mime.content.StringBody: can't find referenced class org.apache.http.entity.ContentType
Warning:com.squareup.picasso.OkHttpDownloader: can't find referenced class com.squareup.okhttp.OkHttpClient
Warning:android.databinding.DataBindingUtil: can't find referenced class android.databinding.DataBindingComponent
答案 0 :(得分:0)
您可以添加以下规则
# Okio
-keep class sun.misc.Unsafe { *; }
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**
#databinding
-dontwarn android.databinding.**
-keep class android.databinding.** { *; }
# OkHttp
-keepattributes Signature
-keepattributes *Annotation*
-keep class com.squareup.okhttp.** { *; }
-keep interface com.squareup.okhttp.** { *; }
-dontwarn com.squareup.okhttp.**
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**