android运行失败错误:任务执行失败':app:compileDebugJavaWithJavac'

时间:2016-09-03 08:20:28

标签: android

Android Studio构建成功,但是当我点击运行应用程序时,会出现以下错误:

  

错误:任务':app:compileDebugJavaWithJavac'的执行失败。   编译失败;有关详细信息,请参阅编译器错误输出。

在终端中运行./gradlew complileDebug --stacktrace --info,我收到以下异常:

  

org.gradle.execution.TaskSelectionException:任务'compileDebug'是   根项目'gp2-android'中含糊不清。候选人是:   'compileDebugAidl','compileDebugAndroidTestAidl',   'compileDebugAndroidTestJavaWithJavac','compileDebugAndroidTestNdk',   'compileDebugAndroidTestRenderscript',   'compileDebugAndroidTestShaders','compileDebugAndroidTestSources',   'compileDebugJavaWithJavac','compileDebugNdk',   'compileDebugRenderscript','compileDebugShaders',   'compileDebugSources','compileDebugUnitTestJavaWithJavac',   'compileDebugUnitTestSources'。           在org.gradle.execution.TaskSelector.getSelection(TaskSelector.java:100)           在org.gradle.execution.TaskSelector.getSelection(TaskSelector.java:75)

这是我的代码:

apply plugin: 'com.android.application'
apply plugin: 'android-apt'


android {
compileSdkVersion 23
buildToolsVersion '23.0.3'

defaultConfig {
    applicationId "com.guanplus.app.android"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "v1.0.1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

buildTypes {

    debug {
        debuggable true
        buildConfigField("boolean", "DEBUG_SERVER_HOST", "true")
        buildConfigField("String", "DEFAULT_IDENTITY_SERVER_HOST", "\"https://api-identity-dev.guanplus.com\"")
        buildConfigField("String", "DEFAULT_ACCOUNTING_SERVER_HOST", "\"http://api-accounting-dev.guanplus.com\"")
        buildConfigField("String", "DEFAULT_WEB_HOST", "\"https://web-gp2-dev.guanplus.com/\"")
        minifyEnabled false
    }

    staging{
        debuggable false
        buildConfigField("boolean", "DEBUG_SERVER_HOST", "false")
        buildConfigField("String", "STAGE_IDENTITY_SERVER_HOST", "\"http://api-identity-stage.guanplus.com\"")
        buildConfigField("String", "STAGE_ACCOUNT_SERVER_HOST", "\"http://api-accounting-stage.guanplus.com\"")
        buildConfigField("String", "STAGE_WEB_HOST", "\"https://web-gp2-stage.chinacloudsites.cn/\"")
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }

    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }

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

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

compile project(':datepicker')
compile project(':loadinglib')
//complie project(path: ':adapterlibrary')

compile 'com.android.support:design:23.1.0'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha2'

//recycleview
compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:v2.0.5'
compile 'com.google.code.gson:gson:2.4'
//rxjava*
compile 'io.reactivex:rxjava:x.y.z'
compile 'io.reactivex:rxandroid:1.0.1'
//retrofit*
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
//retrofit logging*
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
//inject butterknife
compile 'com.jakewharton:butterknife:8.2.1'
apt 'com.jakewharton:butterknife-compiler:8.2.1'
//recycleview
compile 'com.jcodecraeer:xrecyclerview:1.2.7'
compile 'com.yqritc:recyclerview-flexibledivider:1.4.0'
//rxliftcycle
compile 'com.trello:rxlifecycle:0.6.1'
compile 'com.trello:rxlifecycle-components:0.6.1'
//material design
compile 'com.github.rey5137:material:1.2.4'
compile 'com.weiwangcn.betterspinner:library-material:1.1.0'
//MPAndroidChart
compile 'com.github.PhilJay:MPAndroidChart:v3.0.0-beta1'
//smartlayout
compile 'com.ogaclejapan.smarttablayout:library:1.6.1@aar'
compile 'com.ogaclejapan.smarttablayout:utils-v4:1.6.1@aar'
//load pdf
compile 'com.github.barteksc:android-pdf-viewer:2.0.1'
//spin kit
compile 'com.github.ybq:Android-SpinKit:1.0.5'
//BUGhd
compile 'im.fir:fir-sdk:latest.integration@aar'

//test
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'

}

1 个答案:

答案 0 :(得分:0)

无法确定任务':app:compileDebugJavaWithJavac'的依赖关系。

  

在项目“应用”中,已解决的Google Play服务库依赖性取决于    另一个版本(例如“ [18.0。     0]”,但尚未解决该版本。天秤座表现出的行为   ry将是未知的。

解决方案:平台-> android-> Project.properties 在此文件中将此版本替换为-> cordova.system.library.6 = com.google.firebase:firebase-messaging:18 + -> cordova.system.library.6 = com.google.firebase:firebase-messaging:19.0.0

相关问题