简体   繁体   中英

Android Studio : How to get name of current selected product flavor?

I have 2 flavors customized. Right now, I want to collect different resources from svn for each flavor, and it would be easy to handle if there is a way to get name of current selected product flavor, but I have no idea how to do that..

Or Are there any ways to solve this problem?

get current taskStr and check with your flavor's name is contains <br/>

//get current task Str <br/>
String taskStr = getGradle().getStartParameter().getTaskRequests().toString();<br/>

// True if current Flavor is "yourFlavorName"<br/>
taskStr.toLowerCase().contains("yourFlavorName") 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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