2016-10-01 116 views
3

我在我的項目中使用第三方庫,因爲然後proguard發給我這些警告,我不能涉及該庫,這裏是我使用的庫:Lollipin如何解決這些proguard警告

警告我越來越

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:[email protected]') { 
    transitive = true 
} 
compile ('com.github.orangegangsters:lollipin:[email protected]') { 
    transitive = true 
} 

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


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

請幫我!謝謝!

回答

0

嘗試:的

-dontwarn com.github.orangegangsters.lollipin 

代替

-keeppackagenames com.github.orangegangsters.lollipin 
+0

沒有它並沒有奏效。仍然是相同的警告。 –

-3

它使用數據綁定庫是因爲Lollipin的。

只需添加在這裏搖籃:

dataBinding { 
     enabled = true 
} 
+0

這不是一個答案。 –

11

我有同樣的問題,所以我加了如下改變了我的proguard.cfg

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

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

前兩行對我來說已經足夠了 – amorenew

+0

感謝您挽救生命 –

+0

如果您想通過忽略警告來編譯您的代碼,您可以添加rule -ignorewarnings。 –