简体   繁体   English

如何在android studio中调试产品风味?

[英]how to debug product flavor in android studio?

I have two product flavors, free and pro.我有两种产品口味,免费版和专业版。

The launcher activity for both is different.两者的启动器活动是不同的。

But Android studio expects the launcher activity to be in AndroidManifest.xml under src/main/.但是 Android Studio 期望启动器活动位于 src/main/ 下的 AndroidManifest.xml 中。

Gradle is building both flavors correctly but IDE is not able to pick the correct AndroidManifest.xml from respective product flavors like src/free or src/pro. Gradle 正在正确构建这两种风格,但 IDE 无法从相应的产品风格(如 src/free 或 src/pro)中选择正确的 AndroidManifest.xml。

This is happening even after choosing the correct build variant as FreeDebug or ProDebug.即使在选择正确的构建变体作为 FreeDebug 或 ProDebug 之后,也会发生这种情况。

This post has the answer you want.这篇文章有你想要的答案。 [ What Product Flavor does Android Studio build by default in build.gradle? [ Android Studio 默认在 build.gradle 中构建什么 Product Flavor?

You can click in the bottom left hand corner and open a box called "Build Variants" Then select the flavor (variant) you wish to work with.您可以单击左下角的 并打开一个名为“构建变体”的框,然后选择您希望使用的风味(变体)。

我通过手动更改运行配置(运行->编辑配置...在活动 - 启动选项下)解决了这个问题,但这绝对不是最佳解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM