gpt4 book ai didi

android - 添加StikkyHeader android项目后多个dex文件定义Landroid/support/annotation/AnimRes

转载 作者:行者123 更新时间:2023-11-30 02:17:43 25 4
gpt4 key购买 nike

在我的 gradle 文件中添加 'com.github.carlonzo.stikkyheader:core:0.0.2-SNAPSHOT' 库后,我在构建时遇到错误:

com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)

这是我的 gradle.build 文件:

buildscript {
repositories {
mavenCentral()
maven { url 'http://repo1.maven.org/maven2' }
maven { url 'http://download.crashlytics.com/maven' }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }

}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'

}
}
apply plugin: "eclipse"
apply plugin: 'com.android.application'
apply plugin: 'crashlytics'
repositories {
mavenCentral()
maven { url 'http://repo1.maven.org/maven2' }
maven { url 'http://download.crashlytics.com/maven' }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
android {

compileSdkVersion 21
buildToolsVersion "19.1.0"

dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(":libraries:google-play-services-lib")
compile project(":libraries:pager-indicator-lib")
compile project(":libraries:apphance-library-1.9.11")
compile project(":libraries:dialog-manager-lib")
compile 'com.crashlytics.android:crashlytics:1.+'

}

defaultConfig {
minSdkVersion 14
targetSdkVersion 21
testInstrumentationRunner "android.test.InstrumentationTestRunner"
}

signingConfigs {
release {
storeFile file(RELEASE_KEYSTORE_FILE)
storePassword System.getenv("PASSWORD_KEYSTORE")
keyAlias System.getenv("ALIAS_KEYSTORE_JB")
keyPassword System.getenv("PASSWORD_KEYSTORE")
}

debug {
storeFile file(DEBUG_KEYSTORE_FILE_LOCAL)
}

beta {
storeFile file(DEBUG_KEYSTORE_FILE_LOCAL)
}

}

buildTypes {
debug {
debuggable true
signingConfig android.signingConfigs.debug
applicationIdSuffix ".debug"
}
release {
signingConfig signingConfigs.release
}

beta {
debuggable true
signingConfig android.signingConfigs.debug
applicationIdSuffix ".beta"
}
}

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

release {
res.srcDirs = ['res_release']
}

beta {
res.srcDirs = ['res_beta']
}

instrumentTest.setRoot('test')
instrumentTest {
java.srcDirs = ['test']
}
}

lintOptions {
abortOnError false
}
}
task wrapper(type: Wrapper) {
gradleVersion = '1.11'
}
dependencies {
// compile 'com.android.support:support-annotations:20.0.0'
compile 'com.mixpanel.android:mixpanel-android:4.5.2'
compile 'com.android.support:multidex:1.0.0'
compile ('com.facebook.android:facebook-android-sdk:3.22.0')
{
exclude module: 'support-v4'
}

compile ('com.github.carlonzo.stikkyheader:core:0.0.2-SNAPSHOT')
{
exclude module: 'support-v4'
}
}

关于如何修复它的任何想法?谢谢

最佳答案

发生这种情况是因为每个依赖项都有自己对支持库(或在您的情况下为 support.annotation)的依赖项。我的建议是将 exclude module: 'support-v4' 替换为 exclude group: 'com.android.support' 。我建议您将 com.android.support 组排除到您添加的每个依赖项中,并声明您自己对支持库的依赖项

关于android - 添加StikkyHeader android项目后多个dex文件定义Landroid/support/annotation/AnimRes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29032826/

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