Android 如何修复这些proguard警告
我在我的项目中使用了第三方库,此后proguard向我发出了这些警告,我无法将这些警告与该库联系起来,以下是我使用的库: 我收到的警告Android 如何修复这些proguard警告,android,android-studio,proguard,Android,Android Studio,Proguard,我在我的项目中使用了第三方库,此后proguard向我发出了这些警告,我无法将这些警告与该库联系起来,以下是我使用的库: 我收到的警告 Warning:android.databinding.DataBindingUtil: can't find referenced class android.databinding.DataBinderMapper Warning:android.databinding.ViewDataBinding: can't find referenced class
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'
尝试:
而不是
-keeppackagenames com.github.orangegangsters.lollipin
这是因为Lollipin使用数据绑定库 只需在此处添加到gradle:
dataBinding {
enabled = true
}
我也有同样的问题,所以我在proguard.cfg中添加了以下更改
-dontwarn android.databinding.**
-keep class android.databinding.** { *; }
-dontwarn okio.**
-dontwarn retrofit2.Platform$Java8
-keepclasseswithmembers class * {
@retrofit2.http.* <methods>;
}
-dontwarn android.databinding**
-保持类android.databinding.*{*;}
-唐特沃恩·奥基奥**
-dontwarn 2.Platform$Java8
-keepclassswithmembers类*{
@2.http.*;
}
这不是一个答案。前两行就足够我帮你保存lives了。如果你想通过忽略警告来编译代码,你可以添加rule-ignorewarnings。
-dontwarn android.databinding.**
-keep class android.databinding.** { *; }
-dontwarn okio.**
-dontwarn retrofit2.Platform$Java8
-keepclasseswithmembers class * {
@retrofit2.http.* <methods>;
}