12

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/.

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.

This is happening even after choosing the correct build variant as FreeDebug or ProDebug.

Paresh Mangukiya
  • 14,668
  • 7
  • 90
  • 90
dhaval
  • 2,320
  • 8
  • 35
  • 60
  • Android Studio is still EAP. It has many many bugs. – S.D. Aug 24 '13 at 06:11
  • how do you handle such scenarios? I am using gradle to install and test different flavors? – dhaval Aug 24 '13 at 06:16
  • Flavors may define their own launcher activities no issue with that. It appears the IDE wants to launch the main activity only from parent manifest instead of inquiring final compiled package's manifest. Not sure this is intended behavior. Still, you can try changing the main activity in run configurations. – S.D. Aug 24 '13 at 06:54
  • It would help if you pasted your gradle.build script here. – croc Oct 18 '13 at 11:38

2 Answers2

23

This post has the answer you want. [What Product Flavor does Android Studio build by default in build.gradle?

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.

Community
  • 1
  • 1
Matthew
  • 3,231
  • 2
  • 23
  • 25
3

I have worked around this by manually changing the run configuration (Run->Edit Configurations... Under the Activity - Launch option), though that's definitely not an optimal solution.

Adam Ness
  • 5,990
  • 4
  • 25
  • 39