android - Android Studio: Program type already present
问题描述
I'm trying to compile my project in Android Studio and I'm getting this error, I know is because of any dependence is duplicating the support-v4 library but I can't fix it.
Program type already present: android.support.v4.widget.SlidingPaneLayout$PanelSlideListener
Here is my build.gradle. Sliding menu library only depends on support-v4, but I can't remove this dependece as many errors appears then.
apply plugin: 'com.android.application'
buildscript{
repositories {
//maven { url "https://maven.google.com" } // Gradle < 4.0
mavenCentral()
jcenter()
//google()
}
allprojects {
repositories {
mavenCentral() // Add following
jcenter()
}
}
dependencies {
classpath "com.android.tools.build:gradle:3.1.3"
}
}
dependencies {
//implementation fileTree(include: '*.jar', dir: 'libs')
implementation files('libs/wekaSTRIPPED.jar')
implementation files('libs/pad.jar')
implementation files('libs/javacsv.jar')
implementation files('libs/extras.jar')
//implementation (group: 'net.sourceforge.javacsv', name: 'javacsv', version: '2.0'){
//exclude group: 'com.google.android', module: 'support-v4'
//}
implementation 'com.android.support:support-compat:27.1.1'
implementation 'com.android.support:multidex:1.0.0'
implementation('com.android.support:appcompat-v7:27.1.1'){
exclude group: 'com.android.support', module: 'appcompat-v4'
}
//implementation('com.android.support:design:27.1.1') {
// exclude group: 'com.android.support'
//exclude module: 'appcompat-v7'
//exclude module: 'support-v4'
//exclude module: 'appcompat-v4'
//}
implementation project(':SlidingMenu')
implementation ('com.google.code.gson:gson:2.2.2'){
exclude group: 'com.google.android', module: 'support-v4'
exclude group: 'com.google.android', module: 'appcompat-v4'
}
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
multiDexEnabled true
}
configurations.all {
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
androidTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
}
android {
buildToolsVersion '27.0.3'
}
repositories {
google()
}
Thank you for all support.
解决方案
推荐阅读
- javascript - 如何将数据从组件1内部的方法传递到组件2
- arrays - 如何使用 JOLT 规范从一个根元素向嵌套数组中添加 2 个元素?
- php - 我的网站根文件夹的哪个用户:组能够运行作曲家更新?
- rust - 如何在 Rust 中获取具有条件的可变切片
- android - 在 Retrofit API 中使用 FormUrlEncoded 时发布默认值
- c# - 如何使用 mvvm 管理列表视图行中按钮的可见性?
- php - 如何将数组和变量从 php 发送到 android 应用程序?
- objective-c - 在不同增益的 AVAudioPlayerNode 中调度缓冲区
- reactjs - 无法从后端获取数据
- jquery - 窗口关闭导致错误“未定义”在 jquery 中未定义