gradle-release icon indicating copy to clipboard operation
gradle-release copied to clipboard

Task with name ['assembleTst', 'assembleUat', 'assembleProduction']' not found in project ':app

Open Iqra786 opened this issue 6 years ago • 2 comments

I upgraded my android studio from 3.0.1 to 3.1. Since than I unable to build my projects. I'll get error assembleTst task not found. In Android Studio I can see all task in gradle project under build. I can also run through gradlew assembleTst but task not found exception when run through android studio

net.researchgate:gradle-release:2.6.0 is unable to find these build tasks. I am using following configuration.

build.gradle (project)

dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
        classpath "net.researchgate:gradle-release:2.6.0"
    }    

build.gradle(module)

release {
    preTagCommitMessage = '[Release] - pre tag commit: '
    tagCommitMessage = '[Release] - creating tag: '
    newVersionCommitMessage = '[Release] - new version commit: '
    buildTasks = ['assembleTst', 'assembleUat', 'assembleProduction']
    git {
        requireBranch = ''
        pushToCurrentBranch = true
    }
}
Exception:

org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'

Caused by: org.gradle.api.UnknownTaskException: Task with name 'assembleTst' not found in project ':app'.
	at org.gradle.api.internal.tasks.DefaultTaskCollection.createNotFoundException(DefaultTaskCollection.java:80)
	at org.gradle.api.internal.DefaultNamedDomainObjectCollection.getByName(DefaultNamedDomainObjectCollection.java:229)
	at org.gradle.api.internal.DefaultNamedDomainObjectCollection.getAt(DefaultNamedDomainObjectCollection.java:248)
	at org.gradle.api.internal.tasks.DefaultTaskCollection.getAt(DefaultTaskCollection.java:31)
	at org.gradle.api.tasks.TaskCollection$getAt$0.call(Unknown Source)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
	at net.researchgate.release.ReleasePlugin$_apply_closure5.doCall(ReleasePlugin.groovy:122)

Please can you guide what I am doing wrong here. It was working fine before android studio upgrade.

Iqra786 avatar Apr 05 '18 20:04 Iqra786

Hm not sure if it worked before but I guess you have a multi module project and is it possible that under that particular module you don't have all these tasks? That for example the tasks are available under the root but not in the module or the other way around. If you type in "gradlew assembleTst" it will run it in all places the task is found but the release plugin looks for them in the applied project. There is also a beforeReleaseBuild task that you can use to do tests.

Hillkorn avatar Apr 06 '18 19:04 Hillkorn

Hi Thanks for your reply,. It is not multi module project. 'assembleTst', 'assembleUat' and 'assembleProduction are flavours. It does not throw exception when I replace buildTasks = ['assembleTst', 'assembleUat', 'assembleProduction'] with following line buildTasks = ['build']

Iqra786 avatar Apr 09 '18 09:04 Iqra786