簡體   English   中英

android運行失敗錯誤:任務':app:compileDebugJavaWithJavac'的執行失敗

[英]android run failed Error:Execution failed for task ':app:compileDebugJavaWithJavac'

Android Studio 構建成功,但是當我單擊運行應用程序時出現以下錯誤:

錯誤:任務 ':app:compileDebugJavaWithJavac' 的執行失敗。 編譯失敗; 有關詳細信息,請參閱編譯器錯誤輸出。

在終端中運行./gradlew complileDebug --stacktrace --info ,我收到以下異常:

org.gradle.execution.TaskSelectionException:任務“compileDebug”在根項目“gp2-android”中不明確。 候選對象是:'compileDebugAidl'、'compileDebugAndroidTestAidl'、'compileDebugAndroidTestJavaWithJavac'、'compileDebugAndroidTestNdk'、'compileDebugAndroidTestRenderscript'、'compileDebugAndroidTestShaders'、'compileDebugAndroidTestSources'、'compileDebugJavaWithJavac'、'compileDebugNdDebugs'compileDebugs'compile'Renderscript' , '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'

}

無法確定任務“:app:compileDebugJavaWithJavac”的依賴關系。

在項目“app”中,已解析的 Google Play 服務庫依賴項依賴於另一個確切版本(例如“[18.0.0]”,但未解析為該版本。庫表現出的行為將是未知的。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM