2014-12-03 110 views
1

我试图启动我的第一个Android Studio应用程序,并且在尝试运行或调试时反复出现相同的错误。我正在使用Spotify API构建音乐应用程序,并将压缩的jar文件导入到正确的目录中(在我的应用程序的库下)。Android Studio执行失败的任务':app:dexDebug'

什么似乎是问题是,也许我的SDK文件夹是在另一个驱动器?我不这么认为,但这是我能想到的唯一的事情。我甚至移过我的Android Studio文件夹,并尝试从相同的D:驱动器运行它,但没有任何区别。

我也安装了所有合适的SDK包括。 SDK工具,平台工具,SDK构建工具19.1,20,API 19,20,Android支持库,库,Google Play服务,存储库,USB驱动程序和英特尔仿真器。

这是我收到的错误:

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':app:dexDebug'. 
> com.android.ide.common.internal.LoggedErrorException: Failed to run command: 
    D:\adt-bundle-windows-x86_64-20140702(2)\adt-bundle-windows-x86_64-20140702\sdk\build-tools\19.1.0\dx.bat --dex --output C:\Users\Jesse\AndroidStudioProjects\SubRosa\app\build\intermediates\dex\debug C:\Users\Jesse\AndroidStudioProjects\SubRosa\app\build\intermediates\classes\debug C:\Users\Jesse\AndroidStudioProjects\SubRosa\app\build\intermediates\dependency-cache\debug C:\Users\Jesse\AndroidStudioProjects\SubRosa\app\build\intermediates\exploded-aar\com.spotify.sdk\spotifysdk\1.0.0-beta5\libs\jnihelpers-1.0.jar D:\adt-bundle-windows-x86_64-20140702(2)\adt-bundle-windows-x86_64-20140702\sdk\extras\android\m2repository\com\android\support\support-v4\19.0.1\support-v4-19.0.1.jar C:\Users\Jesse\AndroidStudioProjects\SubRosa\app\build\intermediates\exploded-aar\com.spotify.sdk\spotifysdk\1.0.0-beta5\classes.jar C:\Users\Jesse\AndroidStudioProjects\SubRosa\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\19.0.1\classes.jar 
Error Code: 
    1 
Output: 
    'D:\adt-bundle-windows-x86_64-20140702' is not recognized as an internal or external command, 
    operable program or batch file. 


* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

下面是一些我的代码和建立的gradle /道具:

local.properties

sdk.dir=D\:\\adt-bundle-windows-x86_64-20140702(2)\\adt-bundle-windows-x86_64-20140702\\sdk 

的build.gradle(APP)

apply plugin: 'com.android.application' 

    android { 
    compileSdkVersion 19 
    buildToolsVersion '19.1.0' // Note: this version should match the latest build-tools version 
    // that you installed in the SDK manager 

    defaultConfig { 
     applicationId "com.jesse.spalding.subrosa" 
     minSdkVersion 14 
     targetSdkVersion 19 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      runProguard false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 

    compileOptions { 
     sourceCompatibility JavaVersion.VERSION_1_7 
     targetCompatibility JavaVersion.VERSION_1_7 
    } 

    dexOptions { 
     preDexLibraries = false 
    } 
} 

    repositories { 
    mavenCentral() 
    flatDir { 
     dirs 'libs' 
    } 
} 

    dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    compile 'com.spotify.sdk:spotifysdk:[email protected]' 
    compile 'com.android.support:appcompat-v7:19.0.1' 
} 

如果yone有任何想法是什么交易是什么,请让我知道。我需要为最终的项目开始工作,并且出于某种原因无法将这个技术性的东西拿出来。

回答

1

问题似乎是您的SDK位于其中有圆括号的路径中(D:\ adt-bundle-windows-x86_64-20140702(2)\ adt-bundle-windows-x86_64-20140702 \ sdk ),这在构建过程的其中一个阶段造成问题。将SDK移动到名称更简单的路径并在Android Studio中更新其位置(项目结构> SDK位置),您应该很好。

+0

这样做!谢谢。我从来不会猜到(2)会弄乱目录。 – 2014-12-03 23:17:35

+1

我没有在我的路径parentysis。 '/ Users/umer/Development/adt-bundle-mac-x86_64-20140702/sdk',仍然执行失败:app:dexDebug。我该如何解决它? – 2015-01-03 12:52:09

+0

检查你的项目目录路径是否有一些奇怪的迹象。例如,我在我的目录中有'ä'。这产生了类似的错误。 – JohnyTex 2015-01-05 21:19:24

相关问题