很多的时候,我们可能有收费版和普通版,这个时候我们在写的时候,一般我们在使用Android Studio的时候,一般都只是用 debug model. But today, I want tell you a new way to run different version use Android studio.
module build.gradle file :
like this:
productFlavors { anzhi { manifestPlaceholders = [umengHolder: "anzhi"] } mse { applicationId project.MSE_APP_PACKAGE_NAME manifestPlaceholders = [umengHolder: "anzhi"] } xiaojialianhang { applicationId project.XJLH_APP_PACKAGE_NAME manifestPlaceholders = [umengHolder: "anzhi"] } x86 { ndk { abiFilter "x86" } } arm { ndk { abiFilter "armeabi-v7a" } } }
这里我用了多渠道打包,所以这里的UmengHolder 只是一个替换值。
2 最重要的一步,我之前从来没有用过的 一个View in the Android Studio: Build Variants
It is in the left bottom in the windows.
you click it you can see this:
Add caption |
like this:
Now, You just run Ok. You will get new apt is you choise one!
Thanks TO :
http://stackoverflow.com/questions/17656826/what-product-flavor-does-android-studio-build-by-default-in-build-gradle
No comments:
Post a Comment