在 AndroidStudio 3.0+ 中批量更改构建变体 [英] Changing build variants in bulk in AndroidStudio 3.0+

查看:31
本文介绍了在 AndroidStudio 3.0+ 中批量更改构建变体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

快速历史:

  • 我使用的是 AndroidStudio 3.0
  • 我的项目有 100 多个模块(多个应用程序和库).
  • 它们都具有相同的风味尺寸和风味.

现在的问题:如何在 AndroidStudio 3.0+ 中批量更改所有模块的风格而不单独更改每个应用程序?

Now question: how to change flavors for all modules in bulk in AndroidStudio 3.0+ without changing each application separately?

推荐答案

Android Studio 中有两个设置可以在选择应用变体时同时切换所有变体.

There are two settings in Android Studio to enable switching all variants at once when selecting the app variant.

设置为仅同步活动变体";&不要在 Gradle 同步期间构建 Gradle 任务列表".两者都需要禁用,然后我重新启动了一次 Android Studio 和 Gradle 同步.

The settings are "Only sync the active variant" & "Do not build Gradle task list during Gradle sync". Both of them need to be disabled, then I restarted Android Studio once and Gradle sync.

在屏幕截图中的设置禁用后,我从每个动态功能模块(我的项目中有 10 个)切换和等待约 10 秒变为在 <5 秒内进行一次切换.

With the settings in the screenshot disabled, I went from switching and waiting for ~10 seconds per dynamic-feature module (10 in my project) to one single switch in <5 seconds.

注意:这是在 Android Studio 4.0.1 中测试的

Note: This is tested in Android Studio 4.0.1

这篇关于在 AndroidStudio 3.0+ 中批量更改构建变体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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