android– “程序类型已存在”是什么意思?

android– “程序类型已存在”是什么意思?,第1张

概述我正在尝试在AndroidStudio中构建应用.将EclipsePaho库添加为gradle依赖项(或者是Maven?我是Android生态系统的新手)后,我收到以下错误:Programtypealreadypresent:android.support.v4.accessibilityservice.AccessibilityServiceInfoCompatMessage{kind=ERROR,text=Progra

我正在尝试在Android Studio中构建应用.将Eclipse Paho库添加为gradle依赖项(或者是Maven?我是AndroID生态系统的新手)后,我收到以下错误:

Program type already present: androID.support.v4.accessibilityservice.AccessibilityServiceInfoCompatMessage{kind=ERROR, text=Program type already present: androID.support.v4.accessibilityservice.AccessibilityServiceInfoCompat, sources=[UnkNown source file], tool name=Optional.of(D8)}

我已经检查了许多与此错误相关的不同StackOverflow问题,但答案都是特定于某些库的.我不仅要寻找错误的解决方案,还要了解错误的含义.这样,人们就可以更容易地找出针对特定案例的解决方案.到目前为止,还没有答案提供.

从其他StackOverflow答案中,我发现它与我的gradle文件有关.所以,这是app / build.gradle:

apply plugin: 'com.androID.application'androID {    compileSdkVersion 27    defaultConfig {        applicationID "---REDACTED FOR PRIVACY---"        minSdkVersion 15        targetSdkVersion 27        versionCode 1        versionname "1.0"        testInstrumentationRunner "androID.support.test.runner.AndroIDJUnitRunner"    }    buildTypes {        release {            MinifyEnabled false            proguardfiles getDefaultProguardfile('proguard-androID.txt'), 'proguard-rules.pro'        }    }}dependencIEs {    implementation filetree(include: ['*.jar'], dir: 'libs')    implementation 'com.androID.support:appcompat-v7:27.1.0'    implementation 'com.androID.support:support-media-compat:27.1.0'    implementation 'com.androID.support:support-v13:27.1.0'    implementation 'com.Google.androID.gms:play-services-maps:12.0.1'    testImplementation 'junit:junit:4.12'    androIDTestImplementation 'com.androID.support.test:runner:1.0.1'    androIDTestImplementation 'com.androID.support.test.espresso:espresso-core:3.0.1'    implementation 'com.androID.support.constraint:constraint-layout:1.0.2'    implementation 'org.eclipse.paho:org.eclipse.paho.clIEnt.mqttv3:1.0.2'    implementation 'org.eclipse.paho:org.eclipse.paho.androID.service:1.0.2'}repositorIEs {    maven { url 'https://repo.eclipse.org/content/repositorIEs/paho-releases/' }} 

解决方法:

此问题通常来自命名冲突,在您的情况下是support-v4库,由几个库使用.

要查找模块应用程序的依赖项列表(应用程序的默认模块名称),我们可以执行gradlew app:dependencIEs以检索所有库的列表.

我们发现support-v4用于:

//short version of the dependencIEs List highlighting support-v4+--- com.androID.support:support-v13:27.1.0|    \--- com.androID.support:support-v4:27.1.0+--- com.Google.androID.gms:play-services-maps:12.0.1|    +--- com.Google.androID.gms:play-services-base:12.0.1|    |    +--- com.Google.androID.gms:play-services-basement:12.0.1|    |    |    +--- com.androID.support:support-v4:26.1.0 -> 27.1.0 (*)+--- org.eclipse.paho:org.eclipse.paho.androID.service:1.0.2|    +--- com.Google.androID:support-v4:r7  // <- problem here

我们看到地图上的support-v4将使用support-v13提供的版本.

我们还看到eclipse库正在使用另一个版本(r7 ??).

要解决您的问题,您可以尝试从此eclipse库中排除模块support-v4,如下所示:

implementation ('org.eclipse.paho:org.eclipse.paho.androID.service:1.0.2') {    exclude module: 'support-v4'}

然后你应该能够编译你的应用程序.

顺便说一句,你应该注意eclipse模块不会通过测试你的代码而破坏.

总结

以上是内存溢出为你收集整理的android – “程序类型已存在”是什么意思?全部内容,希望文章能够帮你解决android – “程序类型已存在”是什么意思?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1104211.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-28
下一篇2022-05-28

发表评论

登录后才能评论

评论列表(0条)

    保存