编程语言
首页 > 编程语言> > 库类(来自Android sdk)依赖于程序类(再次,Android sdk)

库类(来自Android sdk)依赖于程序类(再次,Android sdk)

作者:互联网

我们正在从Android Gradle插件2.3.3迁移到Gradle插件3.0.1.我们的应用程序包括一个应用程序模块和一个库模块.几个依赖项是可传递的(使用api关键字连接),但即使使用实现使它们不可传递也无济于事.将所有编译类型依赖项更改为新的依赖项后,调试版本运行良好.然而,Proguard的发布版本显示了成千上万的警告(2.3.3一切顺利)

特别是,我不明白为什么我们有这样的问题,当来自库的Android类依赖于来自程序的Android类时(这里只是几个例子):

Warning: library class android.app.ActionBar$LayoutParams extends or implements program class android.view.ViewGroup$MarginLayoutParams
Warning: library class android.app.ActivityManager$TaskDescription extends or implements program class android.os.Parcelable
Warning: library class android.widget.Toolbar depends on program class android.view.ViewGroup$LayoutParams

总的来说,Gradle插件2.3.3上没有出现下一类警告(因此,已经配置了Proguard):

Warning: there were 72 unresolved references to classes or interfaces.
         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning: there were 1373 instances of library classes depending on program classes.
         You must avoid such dependencies, since the program classes will
         be processed, while the library classes will remain unchanged.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#dependency)
Warning: there were 1056 unresolved references to program class members.
         Your input classes appear to be inconsistent.
         You may need to recompile the code.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
FAILURE: Build failed with an exception.

以下是依赖项列表(gradle -q app:dependencies –configuration developmentDebugRuntimeClasspath):

Configuration 'androidTestCompile' in project ':app' is deprecated. Use 'androidTestImplementation' instead.
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
Configuration 'debugCompile' in project ':vyng-core' is deprecated. Use 'debugImplementation' instead.
Configuration 'compile' in project ':vyng-core' is deprecated. Use 'implementation' instead.

------------------------------------------------------------
Project :app
------------------------------------------------------------

developmentDebugRuntimeClasspath - Resolved configuration for runtime for variant: developmentDebug
+--- io.objectbox:objectbox-android-objectbrowser:1.3.4
|    \--- io.objectbox:objectbox-java:1.3.4
|         +--- io.objectbox:objectbox-java-api:1.3.4
|         +--- org.greenrobot:essentials:3.0.0-RC1
|         +--- com.google.flatbuffers:flatbuffers-java:1.7.2
|         \--- com.google.code.findbugs:jsr305:3.0.2
+--- com.squareup.leakcanary:leakcanary-android:1.5.4
|    \--- com.squareup.leakcanary:leakcanary-analyzer:1.5.4
|         +--- com.squareup.leakcanary:leakcanary-watcher:1.5.4
|         \--- com.squareup.haha:haha:2.0.3
+--- project :vyng-core
|    +--- com.afollestad.material-dialogs:core:0.9.6.0
|    |    +--- com.android.support:support-annotations:27.0.1 -> 27.0.2
|    |    +--- com.android.support:appcompat-v7:27.0.1 -> 27.0.2
|    |    |    +--- com.android.support:support-annotations:27.0.2
|    |    |    +--- com.android.support:support-core-utils:27.0.2
|    |    |    |    +--- com.android.support:support-annotations:27.0.2
|    |    |    |    \--- com.android.support:support-compat:27.0.2
|    |    |    |         +--- com.android.support:support-annotations:27.0.2
|    |    |    |         \--- android.arch.lifecycle:runtime:1.0.3
|    |    |    |              +--- android.arch.lifecycle:common:1.0.3
|    |    |    |              \--- android.arch.core:common:1.0.0
|    |    |    +--- com.android.support:support-fragment:27.0.2
|    |    |    |    +--- com.android.support:support-compat:27.0.2 (*)
|    |    |    |    +--- com.android.support:support-core-ui:27.0.2
|    |    |    |    |    +--- com.android.support:support-annotations:27.0.2
|    |    |    |    |    \--- com.android.support:support-compat:27.0.2 (*)
|    |    |    |    +--- com.android.support:support-core-utils:27.0.2 (*)
|    |    |    |    \--- com.android.support:support-annotations:27.0.2
|    |    |    +--- com.android.support:support-vector-drawable:27.0.2
|    |    |    |    +--- com.android.support:support-annotations:27.0.2
|    |    |    |    \--- com.android.support:support-compat:27.0.2 (*)
|    |    |    \--- com.android.support:animated-vector-drawable:27.0.2
|    |    |         +--- com.android.support:support-vector-drawable:27.0.2 (*)
|    |    |         \--- com.android.support:support-core-ui:27.0.2 (*)
|    |    +--- com.android.support:recyclerview-v7:27.0.1 -> 27.0.2
|    |    |    +--- com.android.support:support-annotations:27.0.2
|    |    |    +--- com.android.support:support-compat:27.0.2 (*)
|    |    |    \--- com.android.support:support-core-ui:27.0.2 (*)
|    |    \--- me.zhanghai.android.materialprogressbar:library:1.4.2
|    |         +--- com.android.support:appcompat-v7:26.0.2 -> 27.0.2 (*)
|    |         \--- com.android.support:support-annotations:26.0.2 -> 27.0.2
|    +--- com.jakewharton:butterknife:8.8.1
|    |    +--- com.jakewharton:butterknife-annotations:8.8.1
|    |    |    \--- com.android.support:support-annotations:25.3.0 -> 27.0.2
|    |    +--- com.android.support:support-annotations:25.3.0 -> 27.0.2
|    |    \--- com.android.support:support-compat:25.3.0 -> 27.0.2 (*)
|    +--- com.android.support:support-annotations:27.0.2
|    +--- com.android.support:customtabs:27.0.2
|    |    +--- com.android.support:support-compat:27.0.2 (*)
|    |    \--- com.android.support:support-annotations:27.0.2
|    +--- com.jakewharton.hugo:hugo-annotations:1.2.1
|    +--- com.jakewharton.hugo:hugo-runtime:1.2.1
|    |    +--- com.jakewharton.hugo:hugo-annotations:1.2.1
|    |    \--- org.aspectj:aspectjrt:1.8.5
|    +--- org.aspectj:aspectjrt:1.8.5
|    +--- com.airbnb.android:lottie:2.2.5
|    |    \--- com.android.support:appcompat-v7:26.1.0 -> 27.0.2 (*)
|    +--- com.muddzdev:styleabletoast:1.0.9
|    |    \--- com.android.support:appcompat-v7:25.3.1 -> 27.0.2 (*)
|    +--- com.facebook.rebound:rebound:0.3.8
|    +--- jp.wasabeef:glide-transformations:3.0.1
|    |    \--- com.github.bumptech.glide:glide:4.0.0
|    |         +--- com.github.bumptech.glide:gifdecoder:4.0.0
|    |         |    \--- com.android.support:support-annotations:25.3.1 -> 27.0.2
|    |         +--- com.github.bumptech.glide:disklrucache:4.0.0
|    |         \--- com.github.bumptech.glide:annotations:4.0.0
|    +--- com.googlecode.libphonenumber:libphonenumber:8.8.1
|    +--- com.bluelinelabs:conductor:2.1.3 -> 2.1.4
|    |    \--- com.android.support:support-annotations:25.3.1 -> 27.0.2
|    +--- io.reactivex.rxjava2:rxjava:2.1.6
|    |    \--- org.reactivestreams:reactive-streams:1.0.1
|    +--- io.reactivex.rxjava2:rxandroid:2.0.1
|    |    \--- io.reactivex.rxjava2:rxjava:2.0.1 -> 2.1.6 (*)
|    +--- com.tbruyelle.rxpermissions2:rxpermissions:0.9.4
|    +--- com.crashlytics.sdk.android:crashlytics:2.6.8
|    |    +--- com.crashlytics.sdk.android:beta:1.2.5
|    |    |    \--- io.fabric.sdk.android:fabric:1.3.17
|    |    +--- io.fabric.sdk.android:fabric:1.3.17
|    |    +--- com.crashlytics.sdk.android:crashlytics-core:2.3.17
|    |    |    +--- io.fabric.sdk.android:fabric:1.3.17
|    |    |    \--- com.crashlytics.sdk.android:answers:1.3.13
|    |    |         \--- io.fabric.sdk.android:fabric:1.3.17
|    |    \--- com.crashlytics.sdk.android:answers:1.3.13 (*)
|    +--- com.jakewharton.timber:timber:4.6.0
|    +--- org.slf4j:slf4j-api:1.7.25
|    +--- com.github.tony19:logback-android-core:1.1.1-6
|    +--- com.github.tony19:logback-android-classic:1.1.1-6
|    |    +--- com.github.tony19:logback-android-core:1.1.1-6
|    |    \--- com.github.tony19:apktool-lib:1.4.4-3
|    |         \--- com.google.android:android:2.1_r1
|    |              +--- commons-logging:commons-logging:1.1.1
|    |              +--- org.apache.httpcomponents:httpclient:4.0.1
|    |              |    +--- org.apache.httpcomponents:httpcore:4.0.1
|    |              |    +--- commons-logging:commons-logging:1.1.1
|    |              |    \--- commons-codec:commons-codec:1.3
|    |              +--- org.khronos:opengl-api:gl1.1-android-2.1_r1
|    |              +--- xerces:xmlParserAPIs:2.6.2
|    |              \--- xpp3:xpp3:1.1.4c
|    +--- com.google.dagger:dagger:2.11
|    |    \--- javax.inject:javax.inject:1
|    +--- com.google.android.exoplayer:exoplayer-core:r2.4.4 -> r2.5.1
|    |    \--- com.android.support:support-annotations:25.4.0 -> 27.0.2
|    +--- com.google.android.exoplayer:exoplayer-dash:r2.4.4 -> r2.5.1
|    |    +--- com.google.android.exoplayer:exoplayer-core:r2.5.1 (*)
|    |    +--- com.android.support:support-annotations:25.4.0 -> 27.0.2
|    |    \--- com.android.support:support-core-utils:25.4.0 -> 27.0.2 (*)
|    +--- com.google.firebase:firebase-core:11.8.0
|    |    \--- com.google.firebase:firebase-analytics:11.8.0
|    |         +--- com.google.android.gms:play-services-basement:11.8.0
|    |         |    +--- com.android.support:support-v4:25.2.0 -> 27.0.2
|    |         |    |    +--- com.android.support:support-compat:27.0.2 (*)
|    |         |    |    +--- com.android.support:support-media-compat:27.0.2
|    |         |    |    |    +--- com.android.support:support-annotations:27.0.2
|    |         |    |    |    \--- com.android.support:support-compat:27.0.2 (*)
|    |         |    |    +--- com.android.support:support-core-utils:27.0.2 (*)
|    |         |    |    +--- com.android.support:support-core-ui:27.0.2 (*)
|    |         |    |    \--- com.android.support:support-fragment:27.0.2 (*)
|    |         |    \--- com.google.android.gms:play-services-basement-license:11.8.0
|    |         +--- com.google.firebase:firebase-common:11.8.0
|    |         |    +--- com.google.android.gms:play-services-basement:11.8.0 (*)
|    |         |    +--- com.google.android.gms:play-services-tasks:11.8.0
|    |         |    |    +--- com.google.android.gms:play-services-basement:11.8.0 (*)
|    |         |    |    \--- com.google.android.gms:play-services-tasks-license:11.8.0
|    |         |    \--- com.google.firebase:firebase-common-license:11.8.0
|    |         +--- com.google.firebase:firebase-analytics-impl:11.8.0
|    |         |    +--- com.google.android.gms:play-services-basement:11.8.0 (*)
|    |         |    +--- com.google.firebase:firebase-iid:11.8.0
|    |         |    |    +--- com.google.android.gms:play-services-basement:11.8.0 (*)
|    |         |    |    +--- com.google.firebase:firebase-common:11.8.0 (*)
|    |         |    |    +--- com.google.android.gms:play-services-tasks:11.8.0 (*)
|    |         |    |    \--- com.google.firebase:firebase-iid-license:11.8.0
|    |         |    +--- com.google.firebase:firebase-common:11.8.0 (*)
|    |         |    +--- com.google.android.gms:play-services-tasks:11.8.0 (*)
|    |         |    \--- com.google.firebase:firebase-analytics-impl-license:11.8.0
|    |         \--- com.google.firebase:firebase-analytics-license:11.8.0
|    +--- com.google.firebase:firebase-config:11.8.0
|    |    +--- com.google.android.gms:play-services-base:11.8.0
|    |    |    +--- com.google.android.gms:play-services-basement:11.8.0 (*)
|    |    |    +--- com.google.android.gms:play-services-tasks:11.8.0 (*)
|    |    |    \--- com.google.android.gms:play-services-base-license:11.8.0
|    |    +--- com.google.android.gms:play-services-basement:11.8.0 (*)
|    |    +--- com.google.firebase:firebase-iid:11.8.0 (*)
|    |    +--- com.google.firebase:firebase-common:11.8.0 (*)
|    |    +--- com.google.android.gms:play-services-tasks:11.8.0 (*)
|    |    \--- com.google.firebase:firebase-config-license:11.8.0
|    +--- com.squareup.retrofit2:retrofit:2.3.0
|    |    \--- com.squareup.okhttp3:okhttp:3.8.0 -> 3.8.1
|    |         \--- com.squareup.okio:okio:1.13.0
|    +--- com.squareup.retrofit2:converter-gson:2.3.0
|    |    +--- com.squareup.retrofit2:retrofit:2.3.0 (*)
|    |    \--- com.google.code.gson:gson:2.7 -> 2.8.2
|    +--- com.squareup.retrofit2:adapter-rxjava2:2.3.0
|    |    +--- com.squareup.retrofit2:retrofit:2.3.0 (*)
|    |    \--- io.reactivex.rxjava2:rxjava:2.0.0 -> 2.1.6 (*)
|    +--- com.squareup.okhttp3:logging-interceptor:3.8.1
|    |    \--- com.squareup.okhttp3:okhttp:3.8.1 (*)
|    \--- com.squareup.okhttp3:okhttp:3.8.1 (*)
+--- com.beloo.widget:ChipsLayoutManager:0.3.7
+--- com.muddzdev:styleabletoast:1.0.9 (*)
+--- com.github.jarrodholliday:material-about-library:1.8.4
|    +--- com.android.support:appcompat-v7:25.3.1 -> 27.0.2 (*)
|    +--- com.android.support:cardview-v7:25.3.1
|    |    \--- com.android.support:support-annotations:25.3.1 -> 27.0.2
|    +--- com.android.support:design:25.3.1 -> 27.0.2
|    |    +--- com.android.support:support-v4:27.0.2 (*)
|    |    +--- com.android.support:appcompat-v7:27.0.2 (*)
|    |    +--- com.android.support:recyclerview-v7:27.0.2 (*)
|    |    \--- com.android.support:transition:27.0.2
|    |         +--- com.android.support:support-annotations:27.0.2
|    |         \--- com.android.support:support-compat:27.0.2 (*)
|    \--- com.android.support.constraint:constraint-layout:1.0.2 -> 1.1.0-beta4
|         \--- com.android.support.constraint:constraint-layout-solver:1.1.0-beta4
+--- com.vdurmont:emoji-java:3.2.0
+--- eu.davidea:flexible-adapter:5.0.0-rc2
+--- com.airbnb.android:lottie:2.2.5 (*)
+--- com.android.support.constraint:constraint-layout:1.1.0-beta4 (*)
+--- io.reactivex.rxjava2:rxjava:2.1.6 (*)
+--- io.reactivex.rxjava2:rxandroid:2.0.1 (*)
+--- com.tbruyelle.rxpermissions2:rxpermissions:0.9.4
+--- oxim.digital:rx2anim:0.9.1
|    +--- com.android.support:appcompat-v7:25.0.0 -> 27.0.2 (*)
|    \--- com.android.support:support-annotations:25.0.0 -> 27.0.2
+--- com.jakewharton.rxbinding2:rxbinding:2.0.0
|    +--- io.reactivex.rxjava2:rxjava:2.0.2 -> 2.1.6 (*)
|    +--- io.reactivex.rxjava2:rxandroid:2.0.0 -> 2.0.1 (*)
|    \--- com.android.support:support-annotations:25.1.1 -> 27.0.2
+--- com.crashlytics.sdk.android:crashlytics:2.6.8 (*)
+--- com.jakewharton.timber:timber:4.6.0
+--- org.slf4j:slf4j-api:1.7.25
+--- com.github.tony19:logback-android-core:1.1.1-6
+--- com.github.tony19:logback-android-classic:1.1.1-6 (*)
+--- com.google.code.gson:gson:2.8.2
+--- com.googlecode.libphonenumber:libphonenumber:8.8.1
+--- com.facebook.android:facebook-android-sdk:4.24.0
|    +--- com.android.support:support-v4:25.3.1 -> 27.0.2 (*)
|    +--- com.android.support:appcompat-v7:25.3.1 -> 27.0.2 (*)
|    +--- com.android.support:cardview-v7:25.3.1 (*)
|    \--- com.parse.bolts:bolts-android:1.4.0
|         +--- com.parse.bolts:bolts-tasks:1.4.0
|         \--- com.parse.bolts:bolts-applinks:1.4.0
|              \--- com.parse.bolts:bolts-tasks:1.4.0
+--- com.writingminds:FFmpegAndroid:0.3.2
+--- com.google.guava:guava:23.0-android
|    +--- com.google.code.findbugs:jsr305:1.3.9 -> 3.0.2
|    +--- com.google.errorprone:error_prone_annotations:2.0.18
|    +--- com.google.j2objc:j2objc-annotations:1.1
|    \--- org.codehaus.mojo:animal-sniffer-annotations:1.14
+--- com.github.bumptech.glide:glide:4.0.0 (*)
+--- jp.wasabeef:glide-transformations:3.0.1 (*)
+--- com.android.support:appcompat-v7:27.0.2 (*)
+--- com.android.support:design:27.0.2 (*)
+--- com.android.support:support-annotations:27.0.2
+--- com.google.firebase:firebase-core:11.8.0 (*)
+--- com.google.firebase:firebase-auth:11.8.0
|    +--- com.google.android.gms:play-services-base:11.8.0 (*)
|    +--- com.google.android.gms:play-services-basement:11.8.0 (*)
|    +--- com.google.firebase:firebase-common:11.8.0 (*)
|    +--- com.google.android.gms:play-services-tasks:11.8.0 (*)
|    \--- com.google.firebase:firebase-auth-license:11.8.0
+--- com.google.firebase:firebase-messaging:11.8.0
|    +--- com.google.firebase:firebase-iid:11.8.0 (*)
|    +--- com.google.android.gms:play-services-basement:11.8.0 (*)
|    +--- com.google.firebase:firebase-common:11.8.0 (*)
|    \--- com.google.firebase:firebase-messaging-license:11.8.0
+--- com.google.firebase:firebase-invites:11.8.0
|    +--- com.google.android.gms:play-services-appinvite:11.8.0
|    |    +--- com.google.android.gms:play-services-base:11.8.0 (*)
|    |    +--- com.google.android.gms:play-services-basement:11.8.0 (*)
|    |    +--- com.google.firebase:firebase-dynamic-links:11.8.0
|    |    |    +--- com.google.android.gms:play-services-base:11.8.0 (*)
|    |    |    +--- com.google.android.gms:play-services-basement:11.8.0 (*)
|    |    |    +--- com.google.firebase:firebase-common:11.8.0 (*)
|    |    |    +--- com.google.android.gms:play-services-tasks:11.8.0 (*)
|    |    |    \--- com.google.firebase:firebase-dynamic-links-license:11.8.0
|    |    +--- com.google.android.gms:play-services-tasks:11.8.0 (*)
|    |    \--- com.google.android.gms:play-services-appinvite-license:11.8.0
|    \--- com.google.firebase:firebase-analytics:11.8.0 (*)
+--- com.bluelinelabs:conductor:2.1.4 (*)
+--- com.google.dagger:dagger:2.11 (*)
+--- com.facebook.android:account-kit-sdk:4.24.0
|    +--- com.android.support:appcompat-v7:25.3.1 -> 27.0.2 (*)
|    +--- com.android.support:design:25.3.1 -> 27.0.2 (*)
|    \--- com.android.support:support-v4:25.3.1 -> 27.0.2 (*)
+--- com.google.android.exoplayer:exoplayer-ui:r2.5.1
|    +--- com.google.android.exoplayer:exoplayer-core:r2.5.1 (*)
|    \--- com.android.support:support-annotations:25.4.0 -> 27.0.2
+--- com.google.android.exoplayer:exoplayer-core:r2.5.1 (*)
+--- com.google.android.exoplayer:exoplayer-dash:r2.5.1 (*)
+--- com.yqritc:android-scalablevideoview:1.0.4
+--- com.github.jarrodholliday:videocache:2.7.1
+--- com.squareup.retrofit2:retrofit:2.3.0 (*)
+--- com.squareup.retrofit2:converter-gson:2.3.0 (*)
+--- com.squareup.retrofit2:adapter-rxjava2:2.3.0 (*)
+--- com.squareup.okhttp3:logging-interceptor:3.8.1 (*)
\--- com.squareup.okhttp3:okhttp:3.8.1 (*)

(*) - dependencies omitted (listed previously)

解决方法:

快速解决:
我在升级到Gradle插件3.0.0时遇到了这个问题,一个快速的解决方案是在你的proguard文件中添加它,

-dontwarn android.**

这也适用于3.0.1.

推荐的:
当您使用的库未从支持库引用android类或引用不推荐的类时,会发生这种情况.我的猜测是,

com.github.tony19:logback-android-core

您正在使用它导致此问题,您可以删除此依赖项并尝试重建.如果这没有帮助,您可以尝试删除您正在使用的任何其他库,但它们最近没有更新.

标签:android,gradle,proguard,gradle-plugin,android-proguard
来源: https://codeday.me/bug/20190828/1748876.html