I can not compile the project gets the following error compilation:
我无法编译这个项目得到以下错误编译:
Error:Execution failed for task ':myApp:dexDebug'.
错误:执行失败:myApp:dexDebug。
com.android.ide.common.internal.LoggedErrorException: Failed to run command: C:\Program Files (x86)\Android\android-studio\sdk\build-tools\21.0.2\dx.bat --dex --output C:\Users\Android Studio\Android Studio\myApp\build\intermediates\dex\debug --input-list=C:\Users\myApp\Downloads\Android Studio\Android Studio\myApp\build\intermediates\tmp\dex\debug\libraryList.txt Error Code: 2 Output: UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
“”,“”,“”,“”,“”,“”,“”,“”,“”,“”,“”,“”。蝙蝠——敏捷——输出C:\Users\Android Studio \ Android Studio \ myApp \制造\中间体\敏捷\调试——输入列表= C:\ Android Studio \ \ myApp \ \用户下载Android Studio \ myApp \制造\中间体\ tmp \敏捷\ \ libraryList调试。txt错误代码:2输出:意外的*异常:com. android.dex.dex.dexexception:多个dex文件定义了Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
Of course, this code solve my problem
当然,这段代码解决了我的问题。
configurations { all*.exclude group: 'com.android.support', module: 'support-v4'
配置{ *。排除集团:“com.android。支持”模块:“support-v4”
but unfortunately does not satisfy me
但不幸的是,我并不满足。
dependencies {
compile fileTree(include: '*.jar', dir: 'libs')
compile 'com.android.support:support-v4:21.+'
compile project(':PullToRefreshListFragment')
compile project(':validator')
compile project(':AndroidBootstrap')
compile 'com.google.android.gms:play-services:6.+'
compile 'com.android.support:appcompat-v7:21+'
compile 'com.github.codechimp-org.apprater:library:1.0.+'
compile 'com.sothree.slidinguppanel:library:+'
compile 'me.grantland:autofittextview:0.2.+'
compile 'io.realm:realm-android:0.71.0'
compile ('com.loopj.android:android-async-http:1.4.6')
{
exclude group: 'com.google.android', module: 'support-v4'
}
compile('de.keyboardsurfer.android.widget:crouton:1.8.5@aar') {
exclude group: 'com.google.android', module: 'support-v4'
}
compile ('io.nlopez.smartlocation:library:2.+')
{
exclude(group: 'com.google.android', module: 'gms:play-services')
}
configurations {
// all*.exclude group: 'com.android.support', module: 'support-v4'
}
how can I compile the project?
我如何编译这个项目?
2 个解决方案
#1
6
This seems to be a common ADT to Android studio migration problem. ADT is looking for a copy of android-support-v4.jar in the libs/ dir while Android studio has it's own internal copy. When migrating the jar file is left in the libs dir which creates a duplicate jar most likely an older version. I deleted the jar in the libs dir and problem was solved.
这似乎是Android studio迁移问题的一个常见的ADT。ADT正在寻找一份android-support-v4的副本。在libs/ dir中jar,而Android studio有它自己的内部副本。当迁移jar文件时,libs dir会创建一个重复的jar,很可能是旧版本。我删除了libs dir中的jar,问题解决了。
#2
3
the library authors should fix them
图书馆的作者应该修复它们。
#1
6
This seems to be a common ADT to Android studio migration problem. ADT is looking for a copy of android-support-v4.jar in the libs/ dir while Android studio has it's own internal copy. When migrating the jar file is left in the libs dir which creates a duplicate jar most likely an older version. I deleted the jar in the libs dir and problem was solved.
这似乎是Android studio迁移问题的一个常见的ADT。ADT正在寻找一份android-support-v4的副本。在libs/ dir中jar,而Android studio有它自己的内部副本。当迁移jar文件时,libs dir会创建一个重复的jar,很可能是旧版本。我删除了libs dir中的jar,问题解决了。
#2
3
the library authors should fix them
图书馆的作者应该修复它们。