android studio cant build

时间:2015-01-20 05:50:25

标签: android android-studio

失败:构建因异常而失败。

出了什么问题:任务执行失败':app:preDexDebug'。

java.io.IOException: Cannot run program "C:\Users\SETIAWAN\AppData\Local\Android\sdk\build-tools\21.1.2\dx.bat": 
CreateProcess error=2, The system cannot find the file specified
Try: Run with --stacktrace option to get the stack trace. Run with -- info or --debug option to get more log output.

BUILD FAILED

Total time: 1 mins 12.109 secs

任何人都可以提供帮助。当我尝试运行dx.bat时。错误Windows无法找到此文件(dx.bat)

1 个答案:

答案 0 :(得分:1)

您可以多次添加android-support-v4.jar。从项目的build.gradle中删除android-support-v4.jar的依赖项,只有一个依赖项,例如:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
}