我正在尝试在Android Studio中构建应用。在将Eclipse Paho库添加为gradle依赖项之后(或者它是Maven?我是Android生态系统的新手),出现以下错误:
Program type already present: android.support.v4.accessibilityservice.AccessibilityServiceInfoCompat
Message{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/' }
}