今天,我尝试使用Android中的"Refactor -> migrate“选项将当前项目迁移到AndroidX,每当我试图编译我的应用程序时,我都会收到一个
程序类型已经存在::app:transformDexArchiveWithExternalLibsDexMergerForDebug AGPBI:{“种类”:“错误”,“文本”:“程序类型已经存在: androidx.annotation.BoolRes",”源“:{},”工具“:”D8“}失败:app:buildInfoGeneratorDebug失败:buildInfoGeneratorDebug失败:buildInfoGeneratorDebug失败。*出了什么问题:任务':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.执行失败
我使用./gradlew app:dependencies来获取我的依赖项列表,但似乎很多库都在使用新的androidx.annotation:annotation:1.0.0依赖项。
//Android
implementation "androidx.constraintlayout:constraintlayout:$constraintLayout"
implementation "androidx.cardview:cardview:$androidX"
implementation "androidx.recyclerview:recyclerview:$androidX"
implementation "androidx.annotation:annotation:1.0.0"
//Material
implementation "com.google.android.material:material:$material"
// ViewModel and LiveData
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle"
annotationProcessor "androidx.lifecycle:lifecycle-compiler:$lifecycle"
//Room
implementation "androidx.room:room-runtime:$room"
annotationProcessor "androidx.room:room-compiler:$room"发布于 2018-10-01 07:20:54
这个问题似乎与我的build.gradle文件中的renderscript api有关:
defaultConfig {
applicationId "xxx"
minSdkVersion 23
targetSdkVersion 28
versionCode versionMajor * 10000 + versionMinor * 100 + versionPatch
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
renderscriptTargetApi 28
renderscriptSupportModeEnabled true
}从块中删除renderscriptSupportModeEnabled和renderscriptTargetApi似乎解决了这个问题。
发布于 2018-10-23 03:48:38
我在迁徙的时候不会发生这种事。但是我在调试模式下运行应用程序,并且不停止调试,运行应用程序而不进行调试(单击android中的run按钮)。
我需要清理这个项目(构建->清洁项目)来解决这个问题。
发布于 2018-09-27 09:58:53
implementation "androidx.annotation:annotation:1.0.0"我认为问题在于这种依赖,试着升级并检查问题是否解决了。如果成功的话,你可以试试这个:-
androidx.annotation:annotation:1.0.0-alpha3如果它不尝试升级依赖项。
https://stackoverflow.com/questions/52533779
复制相似问题