Execution failed for task mockableAndroidJar, mockable-android- . jar already exists

后端 未结 5 1623
借酒劲吻你
借酒劲吻你 2021-01-12 08:26

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:mockab         


        
5条回答
  •  悲哀的现实
    2021-01-12 09:11

    Simply cleanup the existing jar before running the task again. Running cleandoes 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
    }
    

提交回复
热议问题