debugging - 任务 ':app:dexDebug'的Android Studio执行失败

标签 debugging gradle android-studio

我正在尝试启动我的第一个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构建/ Prop :

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

build.gradle(应用程序)
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'
}

如果有人知道这笔交易是什么,请告诉我。我需要开始为最终项目进行这项工作,但由于某种原因无法弄清楚该技术问题。

最佳答案

问题似乎是您的SDK所在的路径中带有括号(D:\ adt-bundle-windows-x86_64-20140702(2)\ adt-bundle-windows-x86_64-20140702 \ sdk),即在构建过程的其中一个阶段中导致问题。将您的SDK移至名称更简单的路径,并在Android Studio中更新其位置(“项目结构”>“SDK位置”),您应该一切顺利。

关于debugging - 任务 ':app:dexDebug'的Android Studio执行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27283128/

相关文章:

asp.net - 在 Visual Studio 中使用断点调试 Typescript

java - if...else 语句不返回任何内容

java - 无法获得类型为org.gradle.api.publish.maven.internal.publication.DefaultMavenPublication的对象的未知属性 'sourcesJar'

java - DateFormat可在 native JUnit测试中使用,但不会由Gradle执行

java - Android Studio 在特定位置动态生成 EditText

android-studio - Android Studio - gradle-diagnostics-X.X.X.jar 上的 Gradle 同步错误

objective-c - 有没有办法在 Objective-C 中捕获发送到 nil 的消息?

c++ - 在 OSX 上使用 QtCreator 调试失败

android - 错误 : unknown tag <:string> in my app

android - 无法安装 Android SDK 平台