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

前端 未结 6 1020
没有蜡笔的小新
没有蜡笔的小新 2020-12-29 23:48

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

6条回答
  •  一向
    一向 (楼主)
    2020-12-30 00:23

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

    task renameBuildTask() << {
      file('build/outputs/apk/app-release.apk').renameTo("AppName-1.0.0-${project.ext.androidVersionCode}.apk")
      dependsOn 'assembleRelease'
    }
    

    Also you can check this question to get better understanding.

    EDIT

    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() << { ... }

提交回复
热议问题