gpt4 book ai didi

android - 构建apk时出错

转载 作者:行者123 更新时间:2023-11-30 01:45:23 24 4
gpt4 key购买 nike

我的错误信息是:

//Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/common/annotations/Beta;
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

//dependencies {
compile project(':appRater')
compile project(':circularImageView')
compile project(':facebookSDK')
compile project(':paperSlidingTab')
compile project(':library')
compile project(':urlImageViewHelper')
compile project(':pullToRefreshLi')
compile project(':libraries:SlidingMenu:library')
compile files('libs/GoogleAdMobAdsSdk-6.4.1.jar')
compile files('libs/httpmime-4.2.5.jar')
compile files('libs/json-org.jar')
compile files('libs/universal-image-loader-1.9.1-with-sources.jar')
compile files('libs/WebSocket.jar')
compile files('libs/gcm.jar')
compile files('libs/applause-sdk-library-2.0.0.jar')
compile 'org.droidparts:droidparts:1.+'
compile 'joda-time:joda-time:2.3'
compile 'com.google.api-client:google-api-client:1.+'
compile 'com.google.api-client:google-api-client-android2:1.+'
compile 'com.google.http-client:google-http-client:1.+'
compile 'com.google.http-client:google-http-client-android2:1.+'
compile 'com.google.oauth-client:google-oauth-client:1.+'
compile 'com.google.code.gson:gson:2.+'
compile 'com.google.guava:guava:11.+'
compile 'com.google.http-client:google-http-client-jackson2:1.+'
compile 'com.google.protobuf:protobuf-java:2.+'
compile 'com.google.android.gms:play-services:3.+'
}

android {
compileSdkVersion 19
buildToolsVersion "19.1.0"

defaultConfig {
minSdkVersion 9
targetSdkVersion 17
}

signingConfigs {
release {
if (System.getenv("GRADLE_KEYSTORE")) {
storeFile = file(System.getenv("GRADLE_KEYSTORE"))
storePassword = System.getenv("GRADLE_KEYSTORE_PASSWORD")
keyAlias = System.getenv("GRADLE_KEY_ALIAS")
keyPassword = System.getenv("GRADLE_KEY_PASSWORD")
}
}
}

buildTypes.debug {
ext.enableCrashlytics = false
}

buildTypes.release {
debuggable false
zipAlignEnabled true
minifyEnabled false
signingConfig signingConfigs.release
}

packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}

lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}

最佳答案

当我们在一个项目中使用具有 2 个或更多版本的相同库时,会出现这种情况。因此,请尝试在您的应用中查找库的版本,尤其是 support-v4 库

   android {
compileSdkVersion 19
buildToolsVersion "19.1.0"

defaultConfig {
...
minSdkVersion 14
targetSdkVersion 19
...

// Enabling multidex support.
multiDexEnabled true
}
...
}

dependencies {
compile 'com.android.support:multidex:1.0.0'
}

你也可以使用下面的代码,这在我的案例中有效

 dexOptions {
incremental true
javaMaxHeapSize "4g"
}

关于android - 构建apk时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33796597/

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