我已向我的app / libs插入jar files。
项目重建得很好,但是当我尝试运行它时出现错误。 我尝试删除每个并重建,但每个都抛出此异常。
错误:任务':app:dexDebug'执行失败。
com.android.ide.common.internal.LoggedErrorException:无法运行命令: C:\ Android_Development \ adt-bundle-windows-x86_64-20140702 \ sdk \ build-tools \ android-4.4W \ dx.bat --dex --num-threads = 4 --output C:\ Users \ egabay \ AndroidStudio \ Journey \ app \ build \ intermediates \ dex \ debug C:\ Users \ egabay \ AndroidStudio \ Journey \ app \ build \ intermediates \ classes \ debug C:\ Users \ egabay \ AndroidStudio \ Journey \ app \ build \ intermediates \ dependency -cache \ debug C:\ Users \ egabay \ AndroidStudio \ Journey \ app \ build \ intermediates \ pre-dexed \ debug \ com.haarman.listviewanimations-2.6.0-87a736264468420dc84a2b039abd98cb30236f3e.jar C:\ Users \ egabay \ AndroidStudio \ Journey \ app \ build \ intermediates \ pre-dexed \ debug \ library-2.4.0-20d32ecd21e3da938f108347439a0d353ef8793e.jar C:\ Users \ egabay \ AndroidStudio \ Journey \ app \ build \ intermediates \ pre-dexed \ debug \ nineoldandroids-2.4.0 -71a8249321cc0bae33765bcea724852248245ce6.jar C:\ Users \ egabay \ AndroidStudio \ Journey \ app \ build \ intermediates \ pre-dexed \ debug \ support-v4-19.1.0-ff079e6ae11e9ea90a76291957a9366f1a1f17f8.jar 错误代码: 2 输出: 意外的顶级例外情况: com.android.dex.DexException:多个dex文件定义Lcom / nineoldandroids / animation / Animator $ AnimatorListener; 在com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594) 在com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552) 在com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533) 在com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170) 在com.android.dx.merge.DexMerger.merge(DexMerger.java:188) 在com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439) 在com.android.dx.command.dexer.Main.runMonoDex(Main.java:287) 在com.android.dx.command.dexer.Main.run(Main.java:230) 在com.android.dx.command.dexer.Main.main(Main.java:199) 在com.android.dx.command.Main.main(Main.java:103)
这是我的build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion '20.0.0'
defaultConfig {
applicationId "egabay.journey"
minSdkVersion 16
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.nhaarman.listviewanimations:library:2.6.0'
compile fileTree(include: ['*.jar'], dir: 'libs')
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile 'com.android.support:support-v4:19.+'
}
repositories {
mavenCentral()
}
我是否需要修改build.gradle?
答案 0 :(得分:1)
好的,我已经解决了。 在我试图理解我从lib文件夹中删除两个jar文件然后撤消(Ctr + shift + z),这导致文件返回到我的项目 SIZE 0 !我不知道为什么。
我已经更新了build.gradle:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/com.haarman.listviewanimations-2.6.0.jar')
}
感谢您的帮助。