gpt4 book ai didi

android - 库已添加 : Gradle Build

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:02:48 24 4
gpt4 key购买 nike

我刚刚用新的 gradle 构建系统更新了我的项目。

尝试了几次之后,我总是因为同样的问题而失败。

我有一个包含许多子库项目的项目。那些使用 support-library-v4,我的主要项目也使用它。经过一番搜索,我发现我必须使用 Maven 链接:

compile 'com.android.support:support-v4:13.0.0' 

我已经添加了这个(并将 jar 留在 libs 文件夹中以实现 eclipse 兼容性)但仍然有同样的错误

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/ActivityCompatHoneycomb;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
at com.android.dx.command.dexer.Main.processClass(Main.java:490)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:459)
at com.android.dx.command.dexer.Main.access$400(Main.java:67)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:398)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
at com.android.dx.command.dexer.Main.processOne(Main.java:422)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:333)
at com.android.dx.command.dexer.Main.run(Main.java:209)
at com.android.dx.command.dexer.Main.main(Main.java:174)
at com.android.dx.command.Main.main(Main.java:91)

我什至尝试删除/libs 文件夹中的那些库,但没有成功

我使用最新版本的 gradle "classpath 'com.android.tools.build:gradle:0.5.4'"但没有运气。

我希望有人有更好的主意?

这是我的构建脚本:

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.4'
}
}

allprojects {
repositories {
mavenCentral()
}
}

apply plugin: 'android'

dependencies {
repositories {
mavenCentral()
}

compile project(':HoloGraphLibrary')
compile project(':CardsUI')
compile project(':Caldroid')
compile project(':BetterPickers')
compile project(':Crouton')
compile project(':ShowcaseView')
compile project(':AboutLibraries')
compile project(':StyledDialogs')

compile 'com.nineoldandroids:library:2.4.0'
compile 'com.android.support:support-v4:13.0.0'
compile 'joda-time:joda-time:2.2'
compile files('libs/ActiveAndroid-3.3.jar')
compile files('libs/crashlytics.jar')
}

android {
compileSdkVersion 17
buildToolsVersion "17.0.0"

defaultConfig {
minSdkVersion 14
targetSdkVersion 17
}

sourceSets {

main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}

instrumentTest.setRoot('tests')
}
}

这是我的一个库的构建脚本:

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.4'
}
}
apply plugin: 'android-library'

dependencies {
// compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.android.support:support-v4:13.0.0'
compile 'joda-time:joda-time:2.2'
}

android {
compileSdkVersion 17
buildToolsVersion "17.0.0"

defaultConfig {
minSdkVersion 8
targetSdkVersion 17
}

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}

instrumentTest.setRoot('tests')
}
}

最佳答案

你确定你所有的子图书馆都有这条线

compile fileTree(dir: 'libs', include: '*.jar')

注释掉了?

关于android - 库已添加 : Gradle Build,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17795460/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com