我正在尝试在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)}
Run Code Online (Sandbox Code Playgroud)
我已经检查了许多与此错误相关的不同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' …Run Code Online (Sandbox Code Playgroud) 我完全不熟悉Android开发,似乎无法解决此错误: "错误:程序类型已存在:android.support.v4.media.MediaBrowserCompat $ CustomActionCallback"
这是我的依赖:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0-alpha1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0-alpha1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0-alpha1'
implementation "android.arch.navigation:navigation-fragment:1.0.0-alpha01"
implementation "android.arch.navigation:navigation-ui:1.0.0-alpha01"
androidTestImplementation 'androidx.test:runner:1.1.0-alpha3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha3'
testImplementation 'junit:junit:4.12'
}
Run Code Online (Sandbox Code Playgroud)
我搜索了一些,最后在开发者页面上找到了"解决重复类错误",但我仍然无法解决这个问题.帮助会非常受欢迎!