gpt4 book ai didi

android - 针对 Android gradle 构建工具 3.3.0 构建时关于 bundle 的 Kotlin 运行时库的警告

转载 作者:行者123 更新时间:2023-11-29 00:56:33 25 4
gpt4 key购买 nike

我正在使用 Kotlin 构建一个针对 Android 构建工具进行编译的 Gradle 插件,这样我就可以使用 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: Some JAR files in the classpath have the Kotlin Runtime library bundled into them. This may cause difficult to debug problems if there's a different version of the Kotlin Runtime library in the classpath. Consider removing these libraries from the classpath

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 has Kotlin runtime bundled into it

这个警告在实践中似乎没有造成任何问题(一切仍然构建和运行正常),但显然我不喜欢那里有警告,而且我不知道是什么导致了它。当我查看依赖关系树时,我什至没有看到任何不是来 self 自己的声明的 bundle 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。

最佳答案

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

Here is the relevant comment .

关于android - 针对 Android gradle 构建工具 3.3.0 构建时关于 bundle 的 Kotlin 运行时库的警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54336667/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com