Android Gradle 构建:重命名 apk [英] Android Gradle build : renaming the apk

查看:26
本文介绍了Android Gradle 构建:重命名 apk的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何调整我的 build.gradle 以更改 apk 的最终基名?(不改变默认后缀)

How can I adapt my build.gradle to change the final basename of the apk(s) ? (without changing the default suffixes)

推荐答案

在 Gradle 1.8 上,project.archivesBaseName 确实有效,但它给出了以下抱怨:

On Gradle 1.8, project.archivesBaseName does work, but it gives this complaint:

按需创建属性(也称为动态属性)已经已弃用,并计划在 Gradle 2.0 中删除.请阅读http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html有关替换动态属性的信息.已弃用动态属性:根项目"上的archivesBaseName"'myapp'",值:"AnotherName".

Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html for information on the replacement for dynamic properties. Deprecated dynamic property: "archivesBaseName" on "root project 'myapp'", value: "AnotherName".

要消除警告(并避免您的构建在 Gradle 2.0 上中断),请使用:

To get rid of the warning (and to avoid your build breaking on Gradle 2.0), use this:

project.ext.set("archivesBaseName", "AnotherName");

...如ExtraPropertiesExtension 文档.

Android Gradle 插件版本 1.1.0 引入了一个破坏 archivesBaseName正如friderbluemle 指出的.但幸运的是,此问题已得到修复(在 1.1.2 版 中).

Android Gradle plugin version 1.1.0 introduced a bug which broke archivesBaseName, as friederbluemle noted. But fortunately this has since been fixed (in version 1.1.2).

这篇关于Android Gradle 构建:重命名 apk的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆