摇篮建立每一个资源文件夹 [英] Gradle builds for every resource folder

查看:138
本文介绍了摇篮建立每一个资源文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能配置摇篮打造几个安卓APK文件,其中每个将只使用一个资源型的文件夹?

我的意思是:

  • 集结hdpi.apk
  • 集结mdpi.apk
  • 集结xhdpi.apk

我知道我以前建设可以简单地删除某些文件夹,但它会很好,如果我可以让自动地。

有没有可能使用摇篮口味?<​​/ P>

解决方案

它没有可能的,但是0.7.0将具备这一功能。

您需要创建3个产品的口味(或更多,如果你想支持所有密度),你就会有一番风味属性来限制对包中的APK什么。

0.7.0会出不久。

注意,多APK支持Play商店不支持密度作为一个过滤器,这将显示为在商店3个不同的应用程序是不是你想要的东西编辑:这实际上是支持多个APK:<一href="http://developer.android.com/google/play/publishing/multiple-apks.html">http://developer.android.com/google/play/publishing/multiple-apks.html

EDIT2:现在0.7 +已经出来了,你可以做到以下几点:

 安卓{
  productFlavors {
    MDPI {
      resConfigsMDPI,nodpi
    }
    华电国际{
      resConfigs华电国际,nodpi
    }
    xhdpi {
      resConfigsxhdpi,nodpi
    }
  }
}
 

Is it possible to config Gradle to build few android apk files where each would be using only one resource-type folder?

I mean:

  • build-hdpi.apk
  • build-mdpi.apk
  • build-xhdpi.apk

I know I could simply remove certain folders before building, but it would be nice if I could make it "automagically".

Would it be possible with using gradle "flavors"?

解决方案

Its not yet possible, but 0.7.0 will have this feature.

You'll need to create 3 product flavors (or more if you want to support all densities), and you'll have a flavor property to restrict what to package in the apk.

0.7.0 will be out shortly.

Note that the Multi APK support in the Play Store does not support density as a filter, that would show up as 3 different apps on the store which is not what you'd want. Edit: this is actually supported by Multiple Apks: http://developer.android.com/google/play/publishing/multiple-apks.html

Edit2: Now that 0.7.+ is out, you can do the following:

android {
  productFlavors {
    mdpi {
      resConfigs "mdpi", "nodpi"
    }
    hdpi {
      resConfigs "hdpi", "nodpi"
    }
    xhdpi {
      resConfigs "xhdpi", "nodpi"
    }
  }
}

这篇关于摇篮建立每一个资源文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆