簡體   English   中英

gradle無法正常工作

[英]gradle does not work correctly

我正在使用Android Studio,因此決定將recyclerView添加到build.gradle。 但是在添加它並同步gradle之后,我得到了這個錯誤:

在此處輸入圖片說明

    Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]

即使我做重建項目,但在這個任務中我也遇到了同樣的錯誤。 對於其他方式,我確實使緩存/重新啟動無效,但是它沒有起作用,仍然存在我的問題。 我關閉了即時運行,但出現了同樣的錯誤。 我在用戶中刪除了.gradle文件夾,但仍然出現此錯誤!!! 我如何解決這個問題?

我的build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
    applicationId "com.example.sayres.mychat"
    minSdkVersion 15
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner  "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'),  'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-  core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile('org.eclipse.paho:org.eclipse.paho.android.service:1.0.2') {
    exclude module: 'support-v4'
}
compile('org.eclipse.paho:org.eclipse.paho.android.service:1.0.3-SNAPSHOT') {
    exclude module: 'support-v4'
}
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}

編輯:

在gradle控制台中,請注意以下幾行:

Error: Some file crunching failed, see logs for details

:app:mergeDebugResources失敗

失敗:構建失敗,發生異常。

  • 出了什么問題:任務':app:mergeDebugResources'的執行失敗。

    錯誤:某些文件處理失敗,請參閱日志以獲取詳細信息

  • 嘗試:使用--stacktrace選項運行以獲取堆棧跟蹤。 使用--info或--debug選項運行以獲取更多日志輸出。

    建立失敗

總時間:3.358秒

這是我的日志: 在此處輸入鏈接描述

我刪除了構建文件夾,但出現了同樣的錯誤。 在這些文件夾中沒有PNG圖像。

在gradle中嘗試此操作,確保清理項目:

 android {
 aaptOptions {  
            cruncherEnabled = false  
        } 
 }

希望這可以幫助。

暫無
暫無

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

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