【问题标题】:android run failed Error:Execution failed for task ':app:compileDebugJavaWithJavac'android运行失败错误:任务':app:compileDebugJavaWithJavac'的执行失败
【发布时间】:2019-10-25 17:24:46
【问题描述】:

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'

}

【问题讨论】:

  • 第二个块也不例外。这是一条消息说要运行gradlew :app:compileDebugJavaWithJavac
  • 而且构建不应该成功...您的 Java 代码没有编译

标签: android


【解决方案1】:

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

在项目“app”中,已解决的 Google Play 服务库依赖项依赖于 另一个精确版本(例如“[18.0. 0]",但没有被解析为该版本。天秤座表现出的行为 ry 将是未知的。

解决方案:Platform->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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-01-08
    • 1970-01-01
    • 2016-05-01
    • 1970-01-01
    • 2017-09-13
    • 2020-03-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多