Android Studio Gradle 2.0.0-alpha1构建错误

时间:2015-11-24 11:18:31

标签: android android-studio gradle build

试用最新的gradle 2.0.0-alpha1版本。 在编译期间给我错误。我完全不知道出了什么问题。 Old gradle 1.5.0正在运行,没有任何问题。 下面是我运行时的输出./gradlew assembleDebug -debug -stacktrace

task={from=abc_list_longpressed_holo.9.png, to=/Users/gillis/AndroidStudioProjects/FootballMania/app/build/intermediates/res/merged/debug/drawable-hdpi-v4/abc_list_longpressed_holo.9.png},
latch=BooleanLatch{signaled=false},
result=false}
12:07:42.224 [DEBUG] [org.gradle.api.Task] Thread(png-cruncher_77): Process(784760824), after shutdown queue_size=0
12:07:42.224 [DEBUG] [org.gradle.api.Task] Shutdown finished in 4689
12:07:42.225 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':app:mergeDebugResources'
12:07:42.225 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :app:mergeDebugResources FAILED
12:07:42.225 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :app:mergeDebugResources (Thread[Task worker Thread 3,5,main]) completed. Took 9.416 secs.
12:07:42.225 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[Daemon worker Thread 12,5,main]] finished, busy: 4.182 secs, idle: 8.516 secs
12:07:42.226 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[Task worker,5,main]] finished, busy: 4.905 secs, idle: 7.799 secs
12:07:42.226 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[Task worker Thread 2,5,main]] finished, busy: 4.809 secs, idle: 7.892 secs
12:07:42.226 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[Task worker Thread 3,5,main]] finished, busy: 11.86 secs, idle: 0.834 secs
12:07:42.227 [ERROR] [org.gradle.BuildExceptionReporter]
12:07:42.227 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
12:07:42.227 [ERROR] [org.gradle.BuildExceptionReporter]
12:07:42.228 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
12:07:42.228 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':app:mergeDebugResources'.
12:07:42.228 [ERROR] [org.gradle.BuildExceptionReporter] > Some file crunching failed, see logs for details
12:07:42.228 [ERROR] [org.gradle.BuildExceptionReporter]
12:07:42.228 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
12:07:42.229 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:mergeDebugResources'.
12:07:42.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
12:07:42.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
12:07:42.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
12:07:42.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
12:07:42.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
12:07:42.229 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
12:07:42.230 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
12:07:42.230 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
12:07:42.230 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
12:07:42.230 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
12:07:42.230 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
12:07:42.230 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:62)
12:07:42.230 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
12:07:42.230 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
12:07:42.231 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
12:07:42.231 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.RuntimeException: Some file crunching failed, see logs for details
12:07:42.231 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.builder.png.QueuedCruncher.waitForAll(QueuedCruncher.java:260)
12:07:42.231 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.builder.png.QueuedCruncher.end(QueuedCruncher.java:280)
12:07:42.231 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.ide.common.res2.MergedResourceWriter.end(MergedResourceWriter.java:132)
12:07:42.231 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.ide.common.res2.DataMerger.mergeData(DataMerger.java:295)
12:07:42.231 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.ide.common.res2.ResourceMerger.mergeData(ResourceMerger.java:400)
12:07:42.231 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.tasks.MergeResources.doFullTaskAction(MergeResources.java:216)
12:07:42.231 [ERROR] [org.gradle.BuildExceptionReporter]    at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:88)
12:07:42.232 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
12:07:42.232 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:244)
12:07:42.232 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220)
12:07:42.232 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:231)
12:07:42.232 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)
12:07:42.232 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
12:07:42.232 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
12:07:42.232 [ERROR] [org.gradle.BuildExceptionReporter]    ... 14 more
12:07:42.232 [ERROR] [org.gradle.BuildExceptionReporter]
12:07:42.233 [LIFECYCLE] [org.gradle.BuildResultLogger]
12:07:42.233 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED
12:07:42.233 [LIFECYCLE] [org.gradle.BuildResultLogger]
12:07:42.233 [LIFECYCLE] [org.gradle.BuildResultLogger] Total time: 23.324 secs

不确定出了什么问题。 png文件的东西? 有人有想法吗? 输出说明了有关日志文件的内容。那些日志文件在哪里?

这是我的gradle文件

apply plugin: 'com.android.application'

buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
    }
}

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.2'

    defaultConfig {
        applicationId "x"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 301
        versionName "301.0"
    }

    dexOptions {
        jumboMode = true
        incremental true
        javaMaxHeapSize "4g"
    }

    lintOptions{
        checkReleaseBuilds false
        abortOnError false
    }
    buildTypes {
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            multiDexEnabled true
        }
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            multiDexEnabled true
        }
        releaseAmazon {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            multiDexEnabled true
        }
    }
    sourceSets {
        main {
            java.srcDirs = ['src']
            assets.srcDirs = ['assets']
            res.srcDirs = ['res']
            manifest.srcFile 'AndroidManifest.xml'
           // aidl.srcDirs = ['src/com']
        }
    }

    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
    }
}

repositories {
    maven { url "https://jitpack.io" }
}

dependencies {
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:cardview-v7:23.1.1'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':holoduke_common')
    //compile 'com.android.support:multidex:1.0.0'
    compile project(':gradientButtons')
    compile 'com.github.codechimp-org.apprater:library:1.0.+'
    //compile 'com.github.nkzawa:socket.io-client:0.3.+'
    compile 'com.google.apis:google-api-services-youtube:v3-rev148-1.20.0'
    compile files('libs/YouTubeAndroidPlayerApi.jar')
    //compile 'com.anjlab.android.iab.v3:library:1.0.+@aar'
    compile project(':ASNE_facebook')
    compile project(':twitter')
    compile project(':vkontakte')
    compile project(':googleplus')
    compile project(':socketio_custom')
    compile 'com.joooonho:selectableroundedimageview:1.0.1'
    compile 'com.github.PhilJay:MPAndroidChart:v2.1.4'
}

4 个答案:

答案 0 :(得分:2)

尝试在 defaultConfig 中设置:

aaptOptions.setProperty("cruncherEnabled", false)

答案 1 :(得分:1)

最近,我遇到了类似的问题。也许和你的一样。 首先,让我告诉你日志在哪里。 只需按下Gradle Console按钮,如下所示。 enter image description here

如果在AS窗口的下方找不到该按钮,您可以在菜单中重新显示该按钮:View - Tool Windows - Gradle Console

然后再次构建项目,请参阅Gradle控制台中的日志。如果您的错误日志与我的“非png文件”相同,则可以检查png文件,该文件可能不是有效的png文件。纠正它,在另一个构建之后你将获得成功。 希望这可以帮到你。

Gook lucky。

答案 2 :(得分:0)

使用gradle-2.10并将类路径com.android.tools.build:gradle:2.0.0-alpha1更改为com.android.tools.build:gradle:2.0.0-beta2

答案 3 :(得分:0)

当我将Studio升级到2.0时,我遇到了同样的情况。如果您的项目中存在损坏的PNG 文件,则会发生这种情况,如此处所述Android Studio Gradle build error :app:mergeDebugResources, Crunching Cruncher loader.png failed

因此,我使用此工具http://www.libpng.org/pub/png/apps/pngcheck.html(对于Windows)并在命令行中使用它作为 E:\ PngCheck \ pngcheck.exe * .png ,用于每个文件夹。 png文件找到了几个。然后我使用SnagIt转换器来修复.png文件。

请保留我的情况,在我的情况下,pngcheck位于带有PngCheck文件夹的E驱动器上。因此,请确保您不要复制粘贴,而是使用pngcheck.exe文件的正确路径。

完成后,我清理Android项目,一切都很顺利。

希望这会有所帮助......