本文介绍了着摆脱"执行失败的任务“:dexDebug'" Android的工作室的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然,这是一个重复,我张贴这一点,我已经试过所有可用的解决方案之后。实际上,我使用的是 SDK库。 CastHelloText是我的项目和放大器;连接-SDK是图书馆。摇篮建立文件如下: -

Although, this is a duplicate, I'm posting this after I've tried all the available solution. I'm actually using Connect sdk library which should be a child of my current project. CastHelloText is my project & connect-SDK is the library. Gradle build files are as below :-

现浇你好摇篮

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
    }
}
repositories {
    mavenCentral()
}

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion '22.0.1'

    defaultConfig {
        minSdkVersion 10
        targetSdkVersion 22
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            res.srcDirs = ['res']
        }
    }
    android.enforceUniquePackageName = false

}

dependencies {
    compile 'com.connectsdk:connect-sdk-android:1.4.+'
    compile project(':Connect-SDK-Android')
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.android.support:mediarouter-v7:22.2.0'
    compile 'com.google.android.gms:play-services-cast:7.5.0'
}

连接-SDK gradle这个

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
        classpath 'org.robolectric:robolectric-gradle-plugin:0.14.+'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}


apply plugin: 'com.android.library'
apply plugin: 'robolectric'
apply plugin: "jacoco"


jacoco {
    toolVersion = "0.7.1.201405082137"
}

task jacocoTestReport(type:JacocoReport, dependsOn: "testDebug") {
    group = "Reporting"

    description = "Generate Jacoco coverage reports"

    classDirectories = fileTree(
            dir: 'build/intermediates/classes/debug',
            excludes: ['**/R.class',
                       '**/R$*.class',
                       '**/*$ViewInjector*.*',
                       '**/BuildConfig.*',
                       '**/Manifest*.*']
    )

    additionalSourceDirs = files(android.sourceSets.main.java.srcDirs)
    sourceDirectories = files(android.sourceSets.main.java.srcDirs)
    executionData = files('build/jacoco/testDebug.exec')

    reports {
        xml.enabled = true
        html.enabled = true
    }

}

test.dependsOn jacocoTestReport

android {
    compileSdkVersion 21
    buildToolsVersion '21.1.2'

    packagingOptions {
        exclude 'LICENSE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE'
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = [
                    'src',
                    'core/src',
                    'modules/google_cast/src'
            ]
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }
        androidTest {
            java.srcDirs = [
                    'core/test/src',
                    'modules/google_cast/test/src'
            ]
        }
    }
    buildTypes {
        debug {
            testCoverageEnabled = true
        }
        release {
            minifyEnabled false
        }
    }

    android.enforceUniquePackageName = false
}

robolectric {
    include '**/*Test.class'
}

dependencies {
    compile files('core/libs/java-websocket-patch.jar')
    compile files('core/libs/javax.jmdns_3.4.1-patch2.jar')

    compile 'com.android.support:support-v4:22.2.0'
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.android.support:mediarouter-v7:22.0.0'
    compile 'com.google.android.gms:play-services-cast:7.5.0'


    androidTestCompile 'org.apache.maven:maven-ant-tasks:2.1.3'
    androidTestCompile('junit:junit:4.+')
    androidTestCompile('org.robolectric:robolectric:2.4') {
        exclude module: 'classworlds'
        exclude module: 'maven-artifact'
        exclude module: 'maven-artifact-manager'
        exclude module: 'maven-error-diagnostics'
        exclude module: 'maven-model'
        exclude module: 'maven-plugin-registry'
        exclude module: 'maven-profile'
        exclude module: 'maven-project'
        exclude module: 'maven-settings'
        exclude module: 'nekohtml'
        exclude module: 'plexus-container-default'
        exclude module: 'plexus-interpolation'
        exclude module: 'plexus-utils'
        exclude module: 'wagon-file'
        exclude module: 'wagon-http-lightweight'
        exclude module: 'wagon-http-shared'
        exclude module: 'wagon-provider-api'
        exclude group: 'com.android.support', module: 'support-v4'
    }
    androidTestCompile 'org.mockito:mockito-core:1.10.19'
    androidTestCompile 'org.powermock:powermock-mockito-release-full:1.6.2'
}

Settings.gradle

include ':app', ':Connect-SDK-Android'

编辑1

文件系统

推荐答案

如果您没有看到从AndroidStudio的构建与CLI然后./gradlew建立检查Studio设置相同的结果...

If you are not seeing same result from AndroidStudio's build versus CLI ./gradlew builds then check your Studio settings ...

如果因为是配置gradle这个包装,你是从极端的右侧控制栏中的gradle这个图标调用AS / gradle这个和你使用的是相同的build.tasks,你应该得到同样的结果。 ...

If AS is configure for "gradle wrapper" and you are invoking AS/gradle from the "gradle" icon in the extreme right-hand side control bar and you are using the same build.tasks, you should get same result....

这篇关于着摆脱"执行失败的任务“:dexDebug'" Android的工作室的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 01:07