在针对Android gradle构建工具3.3.0构建时,警告捆绑的Kotlin Runtime库

问题描述 投票:0回答:1

我正在使用Kotlin构建一个Gradle插件来编译Android构建工具,这样我就可以使用Android Transform API,并在运行时从Android插件获得Android构建配置。到目前为止,我对此配置没有任何问题:

apply plugin: 'java-gradle-plugin'
apply plugin: 'kotlin'
apply plugin: 'maven'

repositories {
    google()
    jcenter()
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

    implementation 'commons-io:commons-io:2.6'
    implementation 'org.ow2.asm:asm:7.0'

    compileOnly gradleApi()
    compileOnly('com.android.tools.build:gradle:3.2.1') {
        exclude group: 'org.jetbrains.kotlin'
    }
}

compileKotlin {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}
compileTestKotlin {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}

请注意,我必须从Android构建工具库中排除Kotlin传递依赖项,或者可能会获得Kotlin版本警告。这很好。

但是,当我将Android构建工具升级到3.3.0时,我在Gradle构建期间收到此警告:

w:类路径中的一些JAR文件捆绑了Kotlin Runtime库。如果类路径中存在不同版本的Kotlin Runtime库,则可能导致难以调试问题。考虑从类路径中删除这些库

w:/path/to/.gradle/caches/modules-2/files-2.1/com.android.tools.build/builder/3.3.0/de1cc306a8a198f59d56cb9a909d9a4f516116e7/builder-3.3.0.jar:Library已将Kotlin运行时捆绑到它

这个警告似乎没有在实践中造成任何问题(一切仍然构建并运行正常),但显然我不喜欢在那里发出警告,我不知道是什么导致它。当我查看依赖树时,我甚至看不到任何来自我自己的声明的捆绑的Kotlin库:

compileClasspath - Compile classpath for compilation 'main' (target  (jvm)).
+--- com.android.tools.build:gradle:3.3.0
|    +--- com.android.tools.build:builder:3.3.0
|    |    +--- com.android.tools.build:builder-model:3.3.0
|    |    |    \--- com.android.tools:annotations:26.3.0
|    |    +--- com.android.tools.build:builder-test-api:3.3.0
|    |    |    \--- com.android.tools.ddms:ddmlib:26.3.0
|    |    |         +--- com.android.tools:common:26.3.0
|    |    |         |    +--- com.android.tools:annotations:26.3.0
|    |    |         |    \--- com.google.guava:guava:26.0-jre
|    |    |         |         +--- com.google.code.findbugs:jsr305:3.0.2
|    |    |         |         +--- org.checkerframework:checker-qual:2.5.2
|    |    |         |         +--- com.google.errorprone:error_prone_annotations:2.1.3 -> 2.2.0
|    |    |         |         +--- com.google.j2objc:j2objc-annotations:1.1
|    |    |         |         \--- org.codehaus.mojo:animal-sniffer-annotations:1.14
|    |    |         \--- net.sf.kxml:kxml2:2.3.0
|    |    +--- com.android.tools:sdklib:26.3.0
|    |    |    +--- com.android.tools.layoutlib:layoutlib-api:26.3.0
|    |    |    |    +--- com.android.tools:common:26.3.0 (*)
|    |    |    |    +--- net.sf.kxml:kxml2:2.3.0
|    |    |    |    +--- com.android.tools:annotations:26.3.0
|    |    |    |    \--- org.jetbrains:annotations:13.0
|    |    |    +--- com.android.tools:dvlib:26.3.0
|    |    |    |    \--- com.android.tools:common:26.3.0 (*)
|    |    |    +--- com.android.tools:repository:26.3.0
|    |    |    |    +--- com.android.tools:common:26.3.0 (*)
|    |    |    |    +--- com.sun.activation:javax.activation:1.2.0
|    |    |    |    +--- org.apache.commons:commons-compress:1.12
|    |    |    |    +--- org.glassfish.jaxb:jaxb-runtime:2.2.11
|    |    |    |    |    +--- org.glassfish.jaxb:jaxb-core:2.2.11
|    |    |    |    |    |    +--- javax.xml.bind:jaxb-api:2.2.12-b140109.1041
|    |    |    |    |    |    +--- org.glassfish.jaxb:txw2:2.2.11
|    |    |    |    |    |    \--- com.sun.istack:istack-commons-runtime:2.21
|    |    |    |    |    +--- org.jvnet.staxex:stax-ex:1.7.7
|    |    |    |    |    \--- com.sun.xml.fastinfoset:FastInfoset:1.2.13
|    |    |    |    \--- com.google.jimfs:jimfs:1.1
|    |    |    |         \--- com.google.guava:guava:18.0 -> 26.0-jre (*)
|    |    |    +--- com.google.code.gson:gson:2.8.0
|    |    |    +--- org.apache.commons:commons-compress:1.12
|    |    |    +--- org.apache.httpcomponents:httpmime:4.5.2
|    |    |    |    \--- org.apache.httpcomponents:httpclient:4.5.2
|    |    |    |         +--- org.apache.httpcomponents:httpcore:4.4.4 -> 4.4.5
|    |    |    |         +--- commons-logging:commons-logging:1.2
|    |    |    |         \--- commons-codec:commons-codec:1.9
|    |    |    \--- org.apache.httpcomponents:httpcore:4.4.5
|    |    +--- com.android.tools:sdk-common:26.3.0
|    |    |    +--- com.android.tools:sdklib:26.3.0 (*)
|    |    |    +--- com.android.tools.build:builder-test-api:3.3.0 (*)
|    |    |    +--- com.android.tools.build:builder-model:3.3.0 (*)
|    |    |    +--- com.android.tools.ddms:ddmlib:26.3.0 (*)
|    |    |    +--- org.bouncycastle:bcpkix-jdk15on:1.56
|    |    |    |    \--- org.bouncycastle:bcprov-jdk15on:1.56
|    |    |    +--- org.bouncycastle:bcprov-jdk15on:1.56
|    |    |    +--- com.google.protobuf:protobuf-java:3.4.0
|    |    |    \--- javax.inject:javax.inject:1
|    |    +--- com.android.tools:common:26.3.0 (*)
|    |    +--- com.android.tools.build:manifest-merger:26.3.0
|    |    |    +--- com.android.tools:common:26.3.0 (*)
|    |    |    +--- com.android.tools:sdklib:26.3.0 (*)
|    |    |    +--- com.android.tools:sdk-common:26.3.0 (*)
|    |    |    +--- com.google.code.gson:gson:2.8.0
|    |    |    \--- net.sf.kxml:kxml2:2.3.0
|    |    +--- com.android.tools.ddms:ddmlib:26.3.0 (*)
|    |    +--- com.android.tools.analytics-library:protos:26.3.0
|    |    |    \--- com.google.protobuf:protobuf-java:3.4.0
|    |    +--- com.android.tools.analytics-library:shared:26.3.0
|    |    |    +--- com.android.tools.analytics-library:protos:26.3.0 (*)
|    |    |    +--- com.android.tools:annotations:26.3.0
|    |    |    +--- com.android.tools:common:26.3.0 (*)
|    |    |    +--- com.google.guava:guava:26.0-jre (*)
|    |    |    \--- com.google.code.gson:gson:2.8.0
|    |    +--- com.android.tools.analytics-library:tracker:26.3.0
|    |    |    +--- com.android.tools:annotations:26.3.0
|    |    |    +--- com.android.tools:common:26.3.0 (*)
|    |    |    +--- com.android.tools.analytics-library:protos:26.3.0 (*)
|    |    |    +--- com.android.tools.analytics-library:shared:26.3.0 (*)
|    |    |    +--- com.google.protobuf:protobuf-java:3.4.0
|    |    |    \--- com.google.guava:guava:26.0-jre (*)
|    |    +--- com.android.tools.build:apksig:3.3.0
|    |    +--- com.android.tools.build:apkzlib:3.3.0
|    |    |    +--- com.google.code.findbugs:jsr305:1.3.9 -> 3.0.2
|    |    |    +--- com.google.guava:guava:23.0 -> 26.0-jre (*)
|    |    |    +--- org.bouncycastle:bcpkix-jdk15on:1.56 (*)
|    |    |    +--- org.bouncycastle:bcprov-jdk15on:1.56
|    |    |    \--- com.android.tools.build:apksig:3.3.0
|    |    +--- com.squareup:javawriter:2.5.0
|    |    +--- org.bouncycastle:bcpkix-jdk15on:1.56 (*)
|    |    +--- org.bouncycastle:bcprov-jdk15on:1.56
|    |    +--- org.ow2.asm:asm:6.0 -> 7.0
|    |    +--- org.ow2.asm:asm-tree:6.0
|    |    |    \--- org.ow2.asm:asm:6.0 -> 7.0
|    |    +--- org.ow2.asm:asm-commons:6.0
|    |    |    \--- org.ow2.asm:asm-tree:6.0 (*)
|    |    +--- org.ow2.asm:asm-util:6.0
|    |    |    \--- org.ow2.asm:asm-tree:6.0 (*)
|    |    +--- it.unimi.dsi:fastutil:7.2.0
|    |    +--- net.sf.jopt-simple:jopt-simple:4.9
|    |    \--- com.googlecode.json-simple:json-simple:1.1
|    +--- com.android.tools.analytics-library:shared:26.3.0 (*)
|    +--- com.android.tools.analytics-library:crash:26.3.0
|    |    +--- com.android.tools:annotations:26.3.0
|    |    +--- com.google.guava:guava:26.0-jre (*)
|    |    +--- org.apache.httpcomponents:httpmime:4.5.2 (*)
|    |    +--- org.apache.httpcomponents:httpcore:4.4.5
|    |    \--- org.apache.httpcomponents:httpclient:4.5.2 (*)
|    +--- com.android.tools.lint:lint-gradle-api:26.3.0
|    |    +--- com.android.tools:sdklib:26.3.0 (*)
|    |    +--- com.android.tools.build:builder-model:3.3.0 (*)
|    |    +--- com.android.tools.build:gradle-api:3.3.0
|    |    |    +--- com.android.tools.build:builder-model:3.3.0 (*)
|    |    |    +--- com.android.tools.build:builder-test-api:3.3.0 (*)
|    |    |    \--- com.google.guava:guava:26.0-jre (*)
|    |    \--- com.google.guava:guava:26.0-jre (*)
|    +--- com.android.tools.build:gradle-api:3.3.0 (*)
|    +--- androidx.databinding:databinding-compiler-common:3.3.0
|    |    +--- androidx.databinding:databinding-common:3.3.0
|    |    +--- com.android.databinding:baseLibrary:3.3.0
|    |    +--- org.antlr:antlr4:4.5.3
|    |    +--- commons-io:commons-io:2.4 -> 2.6
|    |    +--- com.googlecode.juniversalchardet:juniversalchardet:1.0.3
|    |    +--- com.google.guava:guava:26.0-jre (*)
|    |    +--- com.squareup:javapoet:1.8.0
|    |    +--- com.google.code.gson:gson:2.8.0
|    |    +--- com.android.tools:annotations:26.3.0
|    |    \--- com.android.tools.build.jetifier:jetifier-core:1.0.0-beta02
|    |         \--- com.google.code.gson:gson:2.8.0
|    +--- com.android.tools.build:transform-api:2.0.0-deprecated-use-gradle-api
|    +--- org.ow2.asm:asm:6.0 -> 7.0
|    +--- org.ow2.asm:asm-analysis:6.0
|    |    \--- org.ow2.asm:asm-tree:6.0 (*)
|    +--- org.ow2.asm:asm-commons:6.0 (*)
|    +--- org.ow2.asm:asm-util:6.0 (*)
|    +--- net.sf.jopt-simple:jopt-simple:4.9
|    +--- net.sf.proguard:proguard-gradle:6.0.3
|    |    \--- net.sf.proguard:proguard-base:6.0.3
|    +--- com.android.tools.build:bundletool:0.6.0
|    |    +--- com.google.auto.value:auto-value:1.5.2
|    |    +--- com.android.tools.build:aapt2-proto:0.3.1
|    |    |    \--- com.google.protobuf:protobuf-java:3.4.0
|    |    +--- com.google.errorprone:error_prone_annotations:2.2.0
|    |    +--- com.google.guava:guava:26.0-jre (*)
|    |    +--- com.google.protobuf:protobuf-java:3.4.0
|    |    \--- com.google.protobuf:protobuf-java-util:3.4.0
|    |         +--- com.google.protobuf:protobuf-java:3.4.0
|    |         +--- com.google.guava:guava:19.0 -> 26.0-jre (*)
|    |         \--- com.google.code.gson:gson:2.7 -> 2.8.0
|    +--- com.android.tools.build.jetifier:jetifier-core:1.0.0-beta02 (*)
|    \--- com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta02
|         +--- org.ow2.asm:asm:6.0 -> 7.0
|         +--- org.ow2.asm:asm-util:6.0 (*)
|         +--- org.ow2.asm:asm-commons:6.0 (*)
|         +--- org.jdom:jdom2:2.0.6
|         \--- com.android.tools.build.jetifier:jetifier-core:1.0.0-beta02 (*)
+--- org.jetbrains.kotlin:kotlin-stdlib:1.3.20
|    +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.20
|    \--- org.jetbrains:annotations:13.0
+--- commons-io:commons-io:2.6
\--- org.ow2.asm:asm:7.0

有没有办法清理这个警告,或者我在这里查看一个错误?

Gradle版本是5.1.1。

android gradle kotlin gradle-plugin
1个回答
0
投票

我跟踪了Doug在评论中链接的问题跟踪器,发现这已在Android Studio 3.3和Android Studio 3.4中得到修复,如果有人想知道的话。

Here is the relevant comment

© www.soinside.com 2019 - 2024. All rights reserved.