带Android Studio的Ormlite多重索引
我刚刚添加了我的android项目,我得到了以下错误:带Android Studio的Ormlite多重索引,android,android-studio,ormlite,dex,Android,Android Studio,Ormlite,Dex,我刚刚添加了我的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/
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'])
}
apply plugin: 'android-library'
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:support-v4:18.0.+'
}
android {
compileSdkVersion 16
buildToolsVersion "19.0.0"
}
TwoWayView 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'])
}
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'
致:
并将TwoWayViewbuild.gradle
的行从:
buildToolsVersion "19.0.0"
compile 'com.android.support:support-v4:18.0.+'
致:
这似乎是一个不同支持库JAR文件的问题。。。很遗憾Android Studio没有解决多个dex文件的问题。。。我看到了很多这种类型的问题。这个特殊的问题是由于ormlite:android依赖于ormlite:core,两者都定义了相同的类。你可以在这里看到:@Goddchen我想这是一只gradle虫。我们没有什么可做的。嘿,我只是想让你知道我通过使用ormlite android工件的4.48版解决了这个问题。这个问题在那个特定版本中似乎并不存在。