【问题标题】:My app crashes after proguard我的应用程序在 proguard 后崩溃
【发布时间】:2018-05-10 16:15:31
【问题描述】:

我在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

【问题讨论】:

标签: android android-gradle-plugin proguard android-proguard


【解决方案1】:

您可以在下面添加规则

# 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.**

【讨论】:

    猜你喜欢
    • 2014-03-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-06
    • 2013-04-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多