tangens tangens - 1 month ago 107x
Android Question

After update to Android Studio 2.2 / gradle plugin 2.2.0: "could not get unknown property 'assembleRelease'"

After updating Android Studio to version 2.2 and the Gradle-plugin to 2.2.0, I get following error:

"Could not get unknown property 'assembleRelease' for project ':app' of type org.gradle.api.Project."

When I change the plugin version back to 2.1.3 the code still works, but that's no long-term option for me.

My code:

apply plugin: 'com.android.application'

dependencies {

android {

assembleRelease.doLast {

project.ext.androidVersionCode is a variable defined otherwhere and contains a build number. The code in assembleRelease.doLast shall just move/rename the generated apk file.

Thank you for advices!


You may rewrite your task a bit and try like this:

task renameBuildTask() {
  dependsOn 'assembleRelease'

Also you can check this question to get better understanding.


As @tangens said in a comment:

It works when I replace the call gradle assemble by e.g. gradle renameBuildTask. Thank you! The answer contains an error. Correct would be: task renameBuildTask() << { ... }