gpt4 book ai didi

android - Android Studio 中的 Ormlite 多个 dex

转载 作者:太空宇宙 更新时间:2023-11-03 12:54:17 34 4
gpt4 key购买 nike

我刚刚添加了 Ormlite在我的 android 项目上,出现以下错误:

Error:Execution failed for task ':AgCelence:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/my/home/path/apps/Android/sdk/build-tools/19.0.3/dx --dex --output /my/home/path/workspace/my/project/path/build/dex/debug
/my/home/path/workspace/my/project/path/build/classes/debug
/my/home/path/workspace/my/project/path/build/dependency-cache/debug
/my/home/path/workspace/my/project/path/build/pre-dexed/debug/butterknife-4.0.1-5a7b9ed780d5fa0603abb39fdc181c512fa9b1c3.jar
/my/home/path/workspace/my/project/path/build/pre-dexed/debug/classes-1a1090f3a59a705e7e344c2ae25b0c5f88f721d6.jar
/my/home/path/workspace/my/project/path/build/pre-dexed/debug/classes-edaf04f87f77ab0f4105648ab63bdcd09694eb0d.jar
/my/home/path/workspace/my/project/path/build/pre-dexed/debug/dagger-1.2.1-212943657b662e900a542e2d88abbd5fdcaf8d33.jar
/my/home/path/workspace/my/project/path/build/pre-dexed/debug/flurry-3.4.0-6b0fea36afcc1a3b450e16a58c03d9869b754f02.jar
/my/home/path/workspace/my/project/path/build/pre-dexed/debug/gson-2.2.4-3d9d795bb76d7955fd85ce17556cc505830bd1f7.jar
/my/home/path/workspace/my/project/path/build/pre-dexed/debug/javax.inject-1-e8f1138f6c9c0f8271805129c6151ff544950b34.jar
/my/home/path/workspace/my/project/path/build/pre-dexed/debug/ormlite-android-4.9-5eaa7600b65948820881b78781d30698f1033ff5.jar
/my/home/path/workspace/my/project/path/build/pre-dexed/debug/ormlite-core-4.9-25352cf2f40621c7a86eff7f10a40c6a66cdf76a.jar
/my/home/path/workspace/my/project/path/build/pre-dexed/debug/support-v4-19.1.0-8212ff791cfaeb109a87aa612d03eec280361949.jar
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/j256/ormlite/dao/CloseableIterable;
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)

我的“build.gradle”:

apply plugin: 'android'

android {
compileSdkVersion 19
buildToolsVersion '19.0.3'
defaultConfig {
minSdkVersion 15
targetSdkVersion 19
versionCode 1
versionName '0.1.0'
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':porquenaotoolkit')
compile project(':libraries:twoway-view:TwoWayView')
compile 'com.android.support:support-v4:19.+'
compile 'com.squareup.dagger:dagger:1.2.+'
compile 'com.jakewharton:butterknife:4.0.+'
compile 'com.google.code.gson:gson:2.2.+'
compile 'com.j256.ormlite:ormlite-android:4.9'
}

porquenaotoolkit build.gradle:

apply plugin: 'android-library'

android {
compileSdkVersion 19
buildToolsVersion "19.0.3"

defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}

dependencies {
compile 'com.jakewharton:butterknife:4.0.+'
compile 'com.google.code.gson:gson:2.2.+'
compile fileTree(dir: 'libs', include: ['*.jar'])
}

TwoWayView build.gradle:

apply plugin: 'android-library'

repositories {
mavenCentral()
}

dependencies {
compile 'com.android.support:support-v4:18.0.+'
}

android {
compileSdkVersion 16
buildToolsVersion "19.0.0"
}

有人知道如何解决这个问题吗???如果我从 build.gradle 中删除 compile 'com.j256.ormlite:ormlite-android:4.9' 行,问题就不会发生,但我想使用这个库,我想使用 gradle 来管理这个....

最佳答案

我通过更改 build.gradle 的行解决了我自己的问题:

compile 'com.android.support:support-v4:19.+'
compile 'com.j256.ormlite:ormlite-android:4.9'

到:

compile 'com.android.support:support-v4:19.1.0'
compile 'com.j256.ormlite:ormlite-android:4.48'

并从以下位置更改 TwoWayView build.gradle 的行:

buildToolsVersion "19.0.0"
compile 'com.android.support:support-v4:18.0.+'

到:

buildToolsVersion "19.0.3"
compile 'com.android.support:support-v4:19.1.0'

它看起来是不同的支持库 jars 文件的问题......很遗憾 Android Studio 没有解决多个 dex 文件问题......我看到了很多这种类型的问题。

关于android - Android Studio 中的 Ormlite 多个 dex,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23573743/

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