gpt4 book ai didi

android - Android Studio 中的描述性构建变体名称

转载 作者:太空狗 更新时间:2023-10-29 14:44:11 27 4
gpt4 key购买 nike

是否可以为要在 Android Studio 的“Build Variant”下拉菜单中显示的构建风格/构建类型组合定义描述性名称?

例如“使用生产性 API 发布”而不是“prodRelease”:)

最佳答案

没有

After you create and configure your product flavors, click Sync Now in the notification bar. After the sync completes, Gradle automatically creates build variants based on your build types and product flavors, and names them according to <product-flavor><Build-Type>. For example, if you created 'demo' and 'full' product flavors, and kept the default 'debug' and 'release' build types, Gradle creates the following build variants:

demoDebug demoRelease fullDebug fullRelease

根据文档 ApplicationVariantImpl有方法 getNamegetDescription,两者都是计算出来的。 getDescriptionApkVariantData中实现通过以下代码进行分类。

@Override
@NonNull
public String getDescription() {
if (getVariantConfiguration().hasFlavors()) {
return String.format("%s build for flavor %s",
getCapitalizedBuildTypeName(),
getFlavoredName(true));
} else {
return String.format("%s build", getCapitalizedBuildTypeName());
}
}

来源:

http://tools.android.com/tech-docs/new-build-system/user-guide https://developer.android.com/studio/build/build-variants.html

关于android - Android Studio 中的描述性构建变体名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42721129/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com