gpt4 book ai didi

android - 给定的 Artifact 包含一个字符串文字,其包引用为 'android.support.v4',无法安全地重写

转载 作者:行者123 更新时间:2023-12-02 12:56:18 25 4
gpt4 key购买 nike

我正在学习为 android 开发应用程序。特别是媒体播放器的工作原理。目标系统应该是用于汽车的 android。出于这个原因,我从 google 下载了一个示例 UAMP 应用程序,但不幸的是,它无法编译,它太旧了。所以我决定重建一个项目并导入所有模块。对我来说,了解它是如何工作的很重要!无论如何,我已经导入了所有库,在 gradle 和模块中,我已经编译了应用程序的汽车版本,我有这个消息:

*The given artifact contains a string literal with a package reference 'android.support.v4' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx*.


详细地,gradle 解释:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':automotive:mergeDebugJavaResource'.

Could not resolve all files for configuration ':automotive:debugRuntimeClasspath'.
Failed to transform kotlin-android-extensions-1.3.41.jar (org.jetbrains.kotlin:kotlin-android-extensions:1.3.41) to match attributes {artifactType=android-java-res, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: C:\Users\James Tiberius Kirk\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-android-extensions\1.3.41\3bb1958b60435763b1299eb4e2dea5bea3bab2a3\kotlin-android-extensions-1.3.41.jar.
> Failed to transform 'C:\Users\James Tiberius Kirk\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-android-extensions\1.3.41\3bb1958b60435763b1299eb4e2dea5bea3bab2a3\kotlin-android-extensions-1.3.41.jar' using Jetifier. Reason: AmbiguousStringJetifierException, message: The given artifact contains a string literal with a package reference 'android.support.v4' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.. (Run with --stacktrace for more details.)
This is a known exception, and Jetifier won't be able to jetify this library.
>


好的,对不起我的英语不好,但问题很复杂,我的英语不是那么先进。汽车项目由三个分支组成,移动应用程序、汽车应用程序和共享分支。现在我在汽车分支上工作,它包括共享分支。
我做的第一件事是检查一个或多个包含的库是否不是最后一个版本。据我所知,所有库都是最新版本并且与 androidx(我的目标系统)兼容,这里是汽车分支上的包含库列表:

>
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.72"
implementation "androidx.core:core-ktx:1.2.0"
implementation "androidx.constraintlayout:constraintlayout:1.1.3"
implementation "androidx.appcompat:appcompat:1.1.0"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation "androidx.preference:preference:1.1.1"
androidTestImplementation "androidx.test.ext:junit:1.1.1"
androidTestImplementation "androidx.test.espresso:espresso-core:3.2.0"
implementation "com.google.android.exoplayer:extension-mediasession:2.11.4"
implementation "com.google.android.exoplayer:exoplayer-core:2.11.4"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.7'
implementation "com.github.bumptech.glide:glide:4.11.0"
implementation "com.google.gms:google-services:4.3.3"
implementation 'com.google.android.gms:play-services-drive:17.0.0'
implementation 'com.google.android.gms:play-services-auth:18.0.0'
implementation 'com.google.apis:google-api-services-gmail:v1-rev72-1.23.0'
implementation 'com.google.android.material:material:1.2.0-alpha06'


implementation project(path: ':shared')

}


在共享分支中,包含的库是:

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.72"
implementation 'androidx.media:media:1.1.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.2.0"
implementation "com.google.android.exoplayer:extension-mediasession:2.11.4"
implementation "com.google.android.exoplayer:exoplayer-core:2.11.4"
implementation "com.google.android.exoplayer:exoplayer-dash:2.11.4"
implementation "com.google.android.exoplayer:exoplayer-ui:2.11.4"
implementation "com.google.android.exoplayer:exoplayer-hls:2.11.4"
implementation "com.google.android.exoplayer:exoplayer-smoothstreaming:2.11.4"
implementation "com.github.bumptech.glide:glide:4.11.3"

}


所以,我尝试了我知道的任何事情,但问题仍然存在。有没有人可以给我一个建议,一个想法,可以帮助我解决这个问题并继续培训?
非常感谢您的任何贡献。

最佳答案

UAMP version1 不再受支持,并且由于其中的很多内容已被弃用,因此无法正常工作。我的建议是不要导入项目并更改它。您需要从头开始构建自己的。

关于android - 给定的 Artifact 包含一个字符串文字,其包引用为 'android.support.v4',无法安全地重写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61931492/

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