gradle无法正常工作

时间:2017-07-09 07:32:28

标签: android gradle

我正在使用Android Studio,我决定将recyclelerView添加到build.gradle。但是在添加它并同步gradle后我得到了这个错误:

enter image description here

    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 FAILED

失败:构建因异常而失败。

  • 出了什么问题: 任务':app:mergeDebugResources'。

    的执行失败
      

    错误:某些文件崩溃失败,请参阅日志以获取详细信息

  • 尝试: 使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出。

    建立失败

总时间:3.358秒

这是我的日志:enter link description here

我删除了构建文件夹,但我收到了同样的错误。在这些文件夹中没有PNG图像。

1 个答案:

答案 0 :(得分:1)

在gradle中尝试此操作,确保清理项目:

 android {
 aaptOptions {  
            cruncherEnabled = false  
        } 
 }

希望这有帮助。

相关问题