风味组:版本
> v2
> v3
风味组:类型
>免费
>满满的
订购“类型”,“版本”时,我可以构建我的应用程序的4种不同风格:
> FreeV2
> FreeV3
> FullV2
> FullV3
我的源代码树看起来像这样:
/src /free /res /full /res /v2 /java /res AndroIDManifest.xml (features and permissions for v2 flavors) /v3 /java /res AndroIDManifest.xml (features and permissions for v3 flavors)
这正是我想要的,对我的项目非常有效.但是,我希望我能为特定的风味组合组合提供文件.例如,我想为FullV3和FullV2提供不同的AndroIDManifests.我不认为这是可能的,或者?例如:
/src /free /res /full /res /v2 /java /res AndroIDManifest.xml (features and permissions for v2 flavors) /v3 /java /res AndroIDManifest.xml (features and permissions for v3 flavors) /fullv3 AndroIDManifest.xml (features and permissions for full v3 only!) /fullv2 AndroIDManifest.xml (features and permissions for full v2 only!)
我也很高兴能够在gradle构建文件中执行此 *** 作:
productFlavors { free { packagename ... flavorGroup "type" } full { packagename ... flavorGroup "type" } v2 { packagename ... flavorGroup "version" } v3 { packagename ... flavorGroup "version" } fullv2 { ... <-- specifically for the full-v2 combination } fullv3 { ... <-- specifically for the full-v3 combination }}
注意:一种解决方案是只有1个flavor组并明确定义4种flavor:
> freeV2
> freeV3
> fullV2
> fullV3
但是,这对我来说不是一个可行的解决方案,因为我必须复制每个版本的免费和完整版本的所有版本特定代码.
解决方法 此功能已在 Android plugin for Gradle版本0.7.0中添加http://tools.android.com/tech-docs/new-build-system< - 截至2014年1月6日,该链接有效
You can Now have a variant specific source folder if you have flavors.
Only for app (not library or test). name issrc/flavorDeBUG/...
orsrc/flavor1Flavor2DeBUG/
Note the camelcase naming,with lower case for first letter. Its components (res,manifest,etc…) have higher priority than components from build type or flavors. There is also a “flavor combination” source folder available when more than one flavor dimension is used. For instancesrc/flavor1Flavor2/
Note that this is for all combinations of all dimensions. Its priority is higher than single-flavor sourcesets,but lower than build-types.
2014年1月30日更新
IntelliJ IDEA v13.0.2(Build 133.696)现在支持在0.7.0中进行的AndroID Gradle Plugin更改
总结以上是内存溢出为你收集整理的android – 特定gradle风味组合的配置全部内容,希望文章能够帮你解决android – 特定gradle风味组合的配置所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)