Different resource folders for separate tablet & mobile APKs

荒凉一梦 提交于 2020-01-17 07:09:36

问题


I am building an app that has two APKs: one for tablets and the other for mobiles.

The tablet version won't use the drawable of the mobile APK and vice versa.

I want to do this because of APK size.

Can anyone give me pointers how to achieve this?

I tried to use flavors for this but it can make the two APK.


回答1:


You can use Android Flavors for this purpose.

android {
   ...
   defaultConfig {...}
   buildTypes {...}
   productFlavors {
       tablet {
           applicationIdSuffix ".tablet"
           versionNameSuffix "-tablet"
       }
       phone {
           applicationIdSuffix ".phone "
           versionNameSuffix "-phone "
       }
   }

}

Each flavor will create separate build folders,where you can place resource files you wish to override. Here is an excellent tutorial: Mastering "Product Flavors" on Android




回答2:


You can achieve this, as Google play store providing support for multiple apks. You can check here for more details- Creating Multiple APKs for Different Screen Sizes



来源:https://stackoverflow.com/questions/43090052/different-resource-folders-for-separate-tablet-mobile-apks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!