English subtitles

← Flavor Dimensions

Get Embed Code
4 Languages

Showing Revision 4 created 05/24/2016 by Udacity Robot.

  1. There's a couple more things about
    Android Build Variants that you should
  2. know about, but you won't necessarily
    need to use them very often.
  3. Consider a game that contains
    a great deal of drawable resources.
  4. So many in fact that including
    all the drawables for
  5. every resolution would result
    in an unacceptably large APK.
  6. This would be an excellent time to use
    product flavors, one for medium DPI and
  7. one for high DPI.
  8. Now, consider what happens if we
    want to add free and paid flavors.
  9. You'll want both a free and
    paid medium DPI version, and a free and
  10. paid high DPI version.
  11. This comes out to four total flavors.
  12. However, now if you want to include
    additional functionality in
  13. the paid version, for example,
    you have to put it in two places.
  14. One for the paid medium DPI and
    one for the paid high DPI.
  15. Now, suddenly we've lost all
    the code release advantages of
  16. using flavors in the first place.
  17. Fortunately, the Android plug-in
    supports the concept of flavor
  18. dimensions to deal with this use case.
  19. Just like the Android
    plug-in will create tasks for
  20. each combination of build type and
    product flavor.
  21. You will now be able to build every
    possible permutation build type,
  22. product flavor, and flavor dimension.