难道Android的总是包未使用的资源? [英] Does android always package unused resources?

查看:98
本文介绍了难道Android的总是包未使用的资源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序的一些资源会针对不同的品牌有选择地加载。我不希望我们重新品牌的应用程序,所以我想知道,如果未使用的资源将被打包总是每次都设置了完全不同的项目,如果有一种方法避免这种情况。这里有一个例子:

  MyProject的
/ RES
    /布局
        main.xml中(在所有应用程序使用)
        productlist1.xml(应用程序中使用ABC.apk)
        productlist2.xml(应用程序中使用XYZ.apk)

main.xml中应包装在两个ABC和XYZ应用

productlist1.xml应与ABC的应用程序打包,但不与应用XYZ

productlist2.xml应打包应用XYZ而与应用ABC


解决方案

  

我想知道,如果资源
  不使用将总是打包
  在



  

和,如果有一种方法来避免此


使用库项目的。或者,创建一个过滤得到打包在应用程序的任一特定版本的资源定制Ant任务。

I have some resources in my app that are going to be loaded optionally for different brands. I don't want to set up entirely different projects each time we re-brand the app so I want to know if the resources that are not used will be always packaged in and if there is a way to avoid this. Here's an example:

MyProject
/res
    /layout
        main.xml (used in all apps)
        productlist1.xml (used in app ABC.apk)
        productlist2.xml (used in app XYZ.apk)

main.xml should be packaged in both ABC and XYZ apps

productlist1.xml should be packaged with app ABC but not with app XYZ

productlist2.xml should be packaged with app XYZ but not with app ABC

解决方案

I want to know if the resources that are not used will be always packaged in

Yes.

and if there is a way to avoid this

Use library projects. Or, create custom Ant tasks that filter the resources that get packaged in any given version of the app.

这篇关于难道Android的总是包未使用的资源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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