【问题标题】:Android Studio Execution failed for task ':app:dexDebug'任务':app:dexDebug'的Android Studio执行失败
【发布时间】:2014-12-03 22:46:24
【问题描述】:

我正在尝试启动我的第一个 Android Studio 应用,但在尝试运行或调试时一遍又一遍地遇到相同的错误。我正在使用 Spotify API 构建一个音乐应用程序,并将压缩的 jar 文件导入正确的目录(在我的应用程序的 libs 下)。

问题似乎是我的 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:1.0.0-beta5@aar'
    compile 'com.android.support:appcompat-v7:19.0.1'
}

如果有人知道这是什么交易,请告诉我。我需要开始为最终项目做这件事,但由于某种原因无法解决这个技术问题。

【问题讨论】:

    标签: debugging gradle android-studio


    【解决方案1】:

    问题似乎是您的 SDK 位于包含括号的路径中 (D:\adt-bundle-windows-x86_64-20140702(2)\adt-bundle-windows-x86_64-20140702\sdk) ,这会导致构建过程的某个阶段出现问题。将您的 SDK 移动到名称更简单的路径并更新其在 Android Studio 中的位置(项目结构 > SDK 位置),您应该一切顺利。

    【讨论】:

    • 这样就行了!谢谢你。我永远不会猜到 (2) 会弄乱目录。
    • 我的路径中没有括号。 /Users/umer/Development/adt-bundle-mac-x86_64-20140702/sdk,我仍然执行失败:app:dexDebug。我该如何解决?
    • 检查您的项目目录路径中是否有一些奇怪的迹象。例如,我的目录中有“ä”。这产生了类似的错误。
    猜你喜欢
    • 1970-01-01
    • 2015-07-16
    • 2023-03-23
    • 2016-01-11
    • 2015-10-03
    • 1970-01-01
    • 1970-01-01
    • 2015-06-04
    相关资源
    最近更新 更多