微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android – 如何修复这些proguard警告

我正在我的项目中使用第三方库,因为那时proguard正在向我发出这些警告,我无法与该库相关联,这是我正在使用的库: 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:

-keeppackagenames com.github.orangegangsters.lollipin

仍然没有去!我也试图清理和重建项目,但也没有成功.

这是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中
-dontwarn android.databinding.**
-keep class android.databinding.** { *; }

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

原文地址:https://www.jb51.cc/android/313786.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐