How to fix these proguard warnings

我们两清 提交于 2019-12-21 09:19:00

问题


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.

Warnings I am getting

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.

What I have tried?

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.

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'

回答1:


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>;
}



回答2:


Try:

-dontwarn com.github.orangegangsters.lollipin

instead of

-keeppackagenames com.github.orangegangsters.lollipin



回答3:


It's because of Lollipin using Databinding library.

Just add here to gradle:

dataBinding {
        enabled = true
}


来源:https://stackoverflow.com/questions/39810541/how-to-fix-these-proguard-warnings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!