执行任务taskableableJar,mockable-android-失败.罐子已经存在 [英] Execution failed for task mockableAndroidJar, mockable-android- . jar already exists
问题描述
我面临Android Studio 3,gradle android插件3(构建目标为27,并支持lib 27.0.0)的问题
I am facing issue with Android Studio 3, gradle android plugin 3 with build target 27 and support lib 27.0.0
Error:Execution failed for task ':module:mockableAndroidJar'.
> Output file [[...]/build/generated/mockable-android-27.v3.jar] already exists.
我必须不时清理或手动从生成的文件夹中删除所有可模仿的Android jar.因此,这意味着除了获得更好的构建时间外,我还必须大部分时间清理项目.
I have to clean or manually delete all mockable-android jars from the generated folder time to time. So this means instead of getting better build times, I have to clean the project most of the times.
推荐答案
在再次运行任务之前,只需清理现有的jar.运行clean
是可以的,但是在我看来这有点紧张.相反,让android生成的任务依赖于一个非常特定的清理任务:
Simply cleanup the existing jar before running the task again. Running clean
does work, but it's a little intense in my opinion. Instead, make the android-generated task depend on a very specific cleanup task:
task cleanAndroidMock(type: Delete) {
description = 'Deletes the mockable Android jar'
delete fileTree("${project.buildDir}/generated") {
include 'mockable-android*.jar'
}
}
project.afterEvaluate {
tasks['mockableAndroidJar'].dependsOn cleanAndroidMock
}
这篇关于执行任务taskableableJar,mockable-android-失败.罐子已经存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!