gpt4 book ai didi

android - 错误 : Program type already present: androidx. asynclayoutinflater.R

转载 作者:行者123 更新时间:2023-12-01 09:42:55 30 4
gpt4 key购买 nike

我已经尝试将我的应用程序正在使用的 facebook sdk 升级到最新版本(5.1.1),它不知何故让我陷入了将我的项目迁移到 AndroidX 的困境。在完成迁移并解决了一些 gradle 问题之后,我现在遇到了构建问题 Error: Program type already present: androidx.asynclayoutinflater.R
我一直在尝试使用 this answer 来解决我的问题和它的其他变体,但我发现很难找到哪些库正在使用 androidx.asynclayoutinflater.R
当我抛弃我的依赖时,我得到了这个

+--- androidx.databinding:databinding-adapters:3.4.2@aar
+--- androidx.databinding:databinding-runtime:3.4.2@aar
+--- androidx.databinding:databinding-common:3.4.2@jar
+--- androidx.emoji:emoji-appcompat:1.0.0@aar
+--- com.codewaves.stickyheadergrid:stickyheadergrid:0.9.6@aar
+--- com.google.android.material:material:1.0.0@aar
+--- com.kishan.askpermission:askpermission:1.0.3@aar
+--- com.theartofdev.edmodo:android-image-cropper:2.8.0@aar
+--- uk.co.chrisjenx:calligraphy:2.3.0@aar
+--- com.facebook.android:facebook-android-sdk:5.1.1@aar
+--- com.facebook.android:facebook-login:5.1.1@aar
+--- com.facebook.android:facebook-share:5.1.1@aar
+--- com.facebook.android:facebook-common:5.1.1@aar
+--- androidx.appcompat:appcompat:1.0.2@aar
+--- androidx.browser:browser:1.0.0@aar
+--- androidx.cardview:cardview:1.0.0@aar
+--- androidx.constraintlayout:constraintlayout:1.1.3@aar
+--- androidx.gridlayout:gridlayout:1.0.0@aar
+--- androidx.legacy:legacy-support-v13:1.0.0@aar
+--- androidx.legacy:legacy-support-v4:1.0.0@aar
+--- com.andkulikov:transitionseverywhere:1.8.0@aar
+--- com.google.firebase:firebase-messaging:19.0.1@aar
+--- com.google.firebase:firebase-perf:18.0.1@aar
+--- com.github.bumptech.glide:glide:4.8.0@aar
+--- com.google.firebase:firebase-config:18.0.0@aar
+--- com.segment.analytics.android.integrations:firebase:1.3.1@jar
+--- com.google.firebase:firebase-core:17.0.1@aar
+--- com.google.firebase:firebase-analytics:17.0.0@aar
+--- com.google.android.gms:play-services-measurement-api:17.0.0@aar
+--- com.google.firebase:firebase-iid:19.0.1@aar
+--- com.google.firebase:firebase-abt:18.0.0@aar
+--- com.google.firebase:firebase-common:18.0.0@aar
+--- com.google.android.gms:play-services-clearcut:17.0.0@aar
+--- com.google.android.gms:play-services-phenotype:17.0.0@aar
+--- com.google.firebase:firebase-iid-interop:17.0.0@aar
+--- com.google.android.gms:play-services-base:17.0.0@aar
+--- com.google.android.gms:play-services-tasks:17.0.0@aar
+--- com.google.firebase:firebase-measurement-connector:18.0.0@aar
+--- com.google.android.gms:play-services-measurement:17.0.0@aar
+--- com.google.android.gms:play-services-measurement-sdk:17.0.0@aar
+--- com.google.android.gms:play-services-measurement-impl:17.0.0@aar
+--- com.google.android.gms:play-services-stats:17.0.0@aar
+--- com.google.android.gms:play-services-measurement-sdk-api:17.0.0@aar
+--- com.google.android.gms:play-services-measurement-base:17.0.0@aar
+--- com.google.android.gms:play-services-ads-identifier:17.0.0@aar
+--- com.google.android.gms:play-services-basement:17.0.0@aar
+--- androidx.fragment:fragment:1.0.0@aar
+--- androidx.vectordrawable:vectordrawable-animated:1.0.0@aar
+--- ca.barrenechea.header-decor:header-decor:0.2.8@aar
+--- androidx.recyclerview:recyclerview:1.0.0@aar
+--- androidx.legacy:legacy-support-core-ui:1.0.0@aar
+--- com.facebook.android:facebook-places:5.1.1@aar
+--- com.facebook.android:facebook-applinks:5.1.1@aar
+--- com.facebook.android:facebook-messenger:5.1.1@aar
+--- com.facebook.android:facebook-core:5.1.1@aar
+--- androidx.legacy:legacy-support-core-utils:1.0.0@aar
+--- androidx.vectordrawable:vectordrawable:1.0.1@aar
+--- androidx.emoji:emoji-bundled:1.0.0@aar
+--- androidx.emoji:emoji:1.0.0@aar
+--- androidx.media:media:1.0.0@aar
+--- androidx.transition:transition:1.0.0@aar
+--- androidx.loader:loader:1.0.0@aar
+--- androidx.viewpager:viewpager:1.0.0@aar
+--- androidx.coordinatorlayout:coordinatorlayout:1.0.0@aar
+--- androidx.drawerlayout:drawerlayout:1.0.0@aar
+--- androidx.slidingpanelayout:slidingpanelayout:1.0.0@aar
+--- androidx.customview:customview:1.0.0@aar
+--- androidx.swiperefreshlayout:swiperefreshlayout:1.0.0@aar
+--- androidx.asynclayoutinflater:asynclayoutinflater:1.0.0@aar
+--- androidx.core:core:1.0.2@aar
+--- androidx.multidex:multidex:2.0.1@aar
+--- com.anjlab.android.iab.v3:library:1.0.44@jar
+--- com.appsflyer:segment-android-integration:1.18@aar
+--- com.segment.analytics.android.integrations:mixpanel:2.1.0@jar
+--- com.segment.analytics.android:analytics:4.4.0-beta1@jar
+--- com.squareup.okhttp3:logging-interceptor:3.12.0@jar
+--- com.squareup.retrofit2:converter-gson:2.5.0@jar
+--- com.squareup.retrofit2:retrofit:2.5.0@jar
+--- io.branch.sdk.android:library:2.19.5@aar
+--- joda-time:joda-time:2.10.1@jar
+--- me.leolin:ShortcutBadger:1.1.21@aar
+--- me.relex:circleindicator:1.2.2@aar
+--- org.greenrobot:eventbus:3.1.1@jar
+--- se.emilsjolander:StickyScrollViewItems:1.1.0@aar
+--- com.crashlytics.sdk.android:crashlytics:2.7.1@aar
+--- androidx.test.espresso:espresso-idling-resource:3.2.0@aar
+--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31@jar
+--- com.jakewharton.rxbinding:rxbinding:0.3.0@aar
+--- androidx.lifecycle:lifecycle-runtime:2.0.0@aar
+--- androidx.versionedparcelable:versionedparcelable:1.0.0@aar
+--- androidx.collection:collection:1.0.0@jar
+--- androidx.cursoradapter:cursoradapter:1.0.0@aar
+--- androidx.interpolator:interpolator:1.0.0@aar
+--- com.github.bumptech.glide:gifdecoder:4.8.0@aar
+--- androidx.exifinterface:exifinterface:1.0.0@aar
+--- androidx.lifecycle:lifecycle-livedata:2.0.0@aar
+--- androidx.lifecycle:lifecycle-livedata-core:2.0.0@aar
+--- androidx.lifecycle:lifecycle-common:2.0.0@jar
+--- androidx.arch.core:core-runtime:2.0.0@aar
+--- androidx.arch.core:core-common:2.0.0@jar
+--- androidx.documentfile:documentfile:1.0.0@aar
+--- androidx.localbroadcastmanager:localbroadcastmanager:1.0.0@aar
+--- androidx.print:print:1.0.0@aar
+--- androidx.lifecycle:lifecycle-viewmodel:2.0.0@aar
+--- androidx.annotation:annotation:1.0.2@jar
+--- androidx.constraintlayout:constraintlayout-solver:1.1.3@jar
+--- com.appsflyer:af-android-sdk:4.10.0@aar
+--- com.github.bumptech.glide:disklrucache:4.8.0@jar
+--- com.github.bumptech.glide:annotations:4.8.0@jar
+--- com.squareup.okhttp3:okhttp:3.12.0@jar
+--- com.mixpanel.android:mixpanel-android:5.6.2@aar
+--- com.google.code.gson:gson:2.8.2@jar
+--- com.crashlytics.sdk.android:answers-shim:0.0.6@aar
+--- com.crashlytics.sdk.android:beta:1.2.7@aar
+--- com.crashlytics.sdk.android:crashlytics-core:2.4.1@aar
+--- com.crashlytics.sdk.android:answers:1.4.1@aar
+--- io.fabric.sdk.android:fabric:1.4.1@aar
+--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31@jar
+--- io.reactivex:rxjava:1.0.14@jar
+--- com.parse.bolts:bolts-android:1.4.0@jar
+--- com.google.zxing:core:3.3.3@jar
+--- com.google.auto.value:auto-value-annotations:1.6.3@jar
+--- com.squareup.okio:okio:1.15.0@jar
+--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31@jar
+--- org.jetbrains:annotations:13.0@jar
+--- com.parse.bolts:bolts-applinks:1.4.0@jar
\--- com.parse.bolts:bolts-tasks:1.4.0@jar

它显示了 +--- androidx.asynclayoutinflater:asynclayoutinflater:1.0.0@aar 行仅一次(每种产品 flavor /构建类型一次)

更新:
发现了一个更像树的依赖图,这是一个 fragment ,但是有很多这样的东西,甚至不能将它粘贴到 pastebin 有这么多
+--- androidx.appcompat:appcompat:1.0.2
| +--- androidx.fragment:fragment:1.0.0
| | +--- androidx.core:core:1.0.0 -> 1.0.2 (*)
| | +--- androidx.legacy:legacy-support-core-ui:1.0.0
| | | +--- androidx.asynclayoutinflater:asynclayoutinflater:1.0.0
| | | | +--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | | | \--- androidx.core:core:1.0.0 -> 1.0.2 (*)

尝试删除这些似乎没有效果
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1'

我的依赖项看起来像这样
dependencies {
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.browser:browser:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.core:core:1.0.2'
implementation 'androidx.emoji:emoji-appcompat:1.0.0'
implementation 'androidx.emoji:emoji-bundled:1.0.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'ca.barrenechea.header-decor:header-decor:0.2.8'
implementation 'com.andkulikov:transitionseverywhere:1.8.0'
implementation 'com.anjlab.android.iab.v3:library:1.0.44'
implementation 'com.appsflyer:segment-android-integration:1.+'
implementation 'com.codewaves.stickyheadergrid:stickyheadergrid:0.9.6'
implementation 'com.facebook.android:facebook-android-sdk:5.1.1'
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.firebase:firebase-core:17.0.1'
implementation 'com.google.firebase:firebase-messaging:19.0.1'
implementation 'com.google.firebase:firebase-perf:18.0.1'
implementation 'com.kishan.askpermission:askpermission:1.0.3'
implementation 'com.segment.analytics.android.integrations:firebase:1.3.1'
implementation 'com.segment.analytics.android.integrations:mixpanel:2.1.0'
implementation 'com.segment.analytics.android:analytics:4.+'
implementation 'com.squareup.okhttp3:logging-interceptor:3.12.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
implementation 'io.branch.sdk.android:library:2.+'
implementation 'joda-time:joda-time:2.10.1'
implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
implementation 'me.relex:circleindicator:1.2.2@aar'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'se.emilsjolander:StickyScrollViewItems:1.1.0'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
transitive = true;
}
kapt 'com.github.bumptech.glide:compiler:4.8.0'

//---Testing---
testImplementation 'junit:junit:4.12'
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestImplementation('androidx.test.espresso:espresso-contrib:3.1.0') {
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'support-annotations'
exclude module: 'recyclerview-v7'
}
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.2.0'
implementation 'androidx.test.espresso:espresso-idling-resource:3.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestUtil 'androidx.test:orchestrator:1.2.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31"
implementation 'com.jakewharton.rxbinding:rxbinding:0.3.0'
//-------------
}

我也尝试强制支持库版本,不确定这是否有任何用处或者我做错了,但我看到它是在 SO 上的帖子中提出的
final SUPPORT_LIB_VER = '28.0.0'

configurations.all {
resolutionStrategy {
force "com.android.support:appcompat-v7:${SUPPORT_LIB_VER}"
force "com.android.support:support-v4:${SUPPORT_LIB_VER}"
}
}

我的 gradle.properties 中也有这个
android.enableJetifier=true
android.useAndroidX=true

有谁知道一种简单的方法来查找正在使用这种特定依赖关系的内容,以便我可以尝试解决重复问题,或者只知道可能是哪个库导致它?

最佳答案

所以经过几天的痛苦我终于找到了问题

我不得不改变

implementation 'com.segment.analytics.android.integrations:firebase:1.3.1'


implementation 'com.segment.analytics.android.integrations:firebase:1.3.1@aar'

fml

我发现解决此问题的最简单方法是创建一个干净的新 android 项目,并将主项目中的所有依赖项放在那里,然后使用分而治之来确定哪个库具体导致了问题。找到了一个随机的 0 评分答案,该答案建议将 @aar 放在最后而不做任何解释,并且它起作用了。

关于android - 错误 : Program type already present: androidx. asynclayoutinflater.R,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57094328/

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