如何修复这些 proguard 警告 [英] How to fix these proguard warnings

查看:41
本文介绍了如何修复这些 proguard 警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中使用第三方库,从那时起 proguard 向我发出这些警告,我无法与该库相关,这是我正在使用的库:棒棒糖.

I am using a third party library in my project, since then proguard is issuing me these warnings, which I can't relate to that library, Here is the library I am using: Lollipin.

我收到的警告

Warning:android.databinding.DataBindingUtil: can't find referenced class android.databinding.DataBinderMapper
Warning:android.databinding.ViewDataBinding: can't find referenced class android.databinding.DataBinderMapper
Warning:there were 43 unresolved references to classes or interfaces.
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.

我尝试了什么?

我已经像这样编辑了 proguard-rules.pro:

I have edited proguard-rules.pro like this:

-keeppackagenames com.github.orangegangsters.lollipin

还是不行!我也尝试清理和重建项目,但也没有成功.

Still no go! I have also tried to clean and rebuild project that also didn't work out.

这里是 build.gradle:

Here is build.gradle:

apply plugin: 'com.android.application'

 android {
compileSdkVersion 24
buildToolsVersion '24.0.2'

defaultConfig {
    applicationId "com.example.teach"
    minSdkVersion 15
    targetSdkVersion 24
    versionCode 27
    versionName "5.0"
}
buildTypes {
    release {

        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }

}


}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')

compile 'com.android.support:appcompat-v7:24.2.1'
compile('com.mikepenz:materialdrawer:5.6.0@aar') {
    transitive = true
}
compile ('com.github.orangegangsters:lollipin:2.0.0@aar') {
    transitive = true
}

 compile 'com.google.android.gms:play-services-ads:9.6.0'


}
apply plugin: 'com.google.gms.google-services'

推荐答案

我遇到了同样的问题,所以我在 proguard.cfg 中添加了以下更改

I had same issue,so I added below change into my proguard.cfg

-dontwarn android.databinding.**
-keep class android.databinding.** { *; }

-dontwarn okio.**
-dontwarn retrofit2.Platform$Java8
-keepclasseswithmembers class * {
    @retrofit2.http.* <methods>;
}

这篇关于如何修复这些 proguard 警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆