我正在尝试从Eclipse迁移项目,但是在构建项目时,会出现此错误:
Program type already present: android.support.annotation.AttrRes
Message{kind=ERROR, text=Program type already present: android.support.annotation.AttrRes, sources=[Unknown source file], tool name=Optional.of(D8)}
似乎在我阅读其他问题时,某些库是重复的。这是我的build.gradle:
apply plugin: 'com.android.application'
buildscript{
repositories {
maven { url "https://maven.google.com" } // Gradle < 4.0
jcenter()
google()
}
dependencies {
classpath "com.android.tools.build:gradle:3.1.3"
}
}
dependencies {
compile fileTree(include: '*.jar', dir: 'libs')
implementation ('com.android.support:appcompat-v7:27.0.1')
implementation ('com.android.support:design:27.0.1')
implementation project(':SlidingMenu')
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
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()
}
这些是app / libs中的库:
android-suppor-v4.jar extras.jar gcm.jar gson-2.2.2.jar
gson-2.2.2-javadoc.jar gson-2.2.2-sources.jar javacsv.jar pad.jar
wekaSTRIPPED.jar
所以,我不确定该怎么办。感谢您的帮助!