Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6656619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:39:57+00:00 2026-05-26T01:39:57+00:00

I have many graphic resources in my application and I would like to support

  • 0

I have many graphic resources in my application and I would like to support different screen sizes with differently sized graphic resources. However, the app is very large if I include 3 different versions of every graphic resource in the final apk (i.e. res/drawable-hdpi, res/drawable-ldpi, res/drawable-mdpi). So I would like to be able to generate 3 different apks for testing–and eventually deployment–purposes (see using mulitple apks), each with only the relevant graphical resources included.

Is there a way to customize the android build process (I’m using eclipse) to make this possible? If it is not possible in eclipse is it possible from the command line?

My searching indicates that many people are using the build tools Ant and Maven for this type of problem, and that the android-sdk has a tool to support Ant out of the box.

Notes on answer:
After performing the tutorial below follow these steps (they will be clear after the tutorial and reading the ant manual ant the main_rules.xml which comes with the android-sdk):

  1. copy the contents of main_rules into your build.xml (as is specified in the build.xml comments)
  2. Make three new tasks as follows:
  <property name="my.custom_res_folder" value="${basedir}/custom_res"/>
  <property name="my.drawable_folder" value="${my.custom_res_folder}/drawable"/>
  <property name="my.drawable_hdpi" value="${resource.absolute.dir}/drawable-hdpi"/>
  <property name="my.drawable_mdpi" value="${resource.absolute.dir}/drawable-mdpi"/>
  <property name="my.drawable_ldpi" value="${resource.absolute.dir}/drawable-ldpi"/>
  <property name="my.drawable_default" value="${resource.absolute.dir}/drawable"/>
  <target name="my-make-custom-resource-directory">
    <echo message="my-make-custom-resource-directory"/>
    <mkdir dir="${my.custom_res_folder}"/>
    <mkdir dir="${my.drawable_folder}"/>

    <copy todir="${my.custom_res_folder}/layout">
      <fileset dir="${resource.absolute.dir}/layout"/>
    </copy>         

    <copy todir="${my.custom_res_folder}/menu">
      <fileset dir="${resource.absolute.dir}/menu"/>
    </copy>         

    <copy todir="${my.custom_res_folder}/values">
      <fileset dir="${resource.absolute.dir}/values"/>
    </copy>         

  </target>


  <target name="my-make-res-small" depends="my-make-custom-resource-directory">
    <copy todir="${my.drawable_folder}" overwrite="false">
      <fileset dir="${my.drawable_ldpi}"/>
    </copy> 
    <copy todir="${my.drawable_folder}" overwrite="false">
      <fileset dir="${my.drawable_mdpi}"/>
    </copy> 
    <copy todir="${my.drawable_folder}" overwrite="false">
      <fileset dir="${my.drawable_hdpi}"/>          
    </copy> 
    <copy todir="${my.drawable_folder}" overwrite="false">
      <fileset dir="${my.drawable_default}"/>           
    </copy> 

  </target>

  <target name="my-make-res-medium" depends="my-make-custom-resource-directory">
    <copy todir="${my.drawable_folder}" overwrite="false">
      <fileset dir="${my.drawable_mdpi}"/>
    </copy> 
    <copy todir="${my.drawable_folder}" overwrite="false">
      <fileset dir="${my.drawable_hdpi}"/>          
    </copy> 
    <copy todir="${my.drawable_folder}" overwrite="false">
      <fileset dir="${my.drawable_ldpi}"/>
    </copy> 
    <copy todir="${my.drawable_folder}" overwrite="false">
      <fileset dir="${my.drawable_default}"/>           
    </copy> 

  </target>

  <target name="my-make-res-large" depends="my-make-custom-resource-directory">
    <copy todir="${my.drawable_folder}" overwrite="false">
      <fileset dir="${my.drawable_hdpi}"/>
    </copy> 
    <copy todir="${my.drawable_folder}" overwrite="false">
      <fileset dir="${my.drawable_mdpi}"/>          
    </copy> 
    <copy todir="${my.drawable_folder}" overwrite="false">
      <fileset dir="${my.drawable_ldpi}"/>
    </copy> 
    <copy todir="${my.drawable_folder}" overwrite="false">
      <fileset dir="${my.drawable_default}"/>           
    </copy> 

  </target>
  1. after running one of the my-make-res-X targets a new resource folder should be created
  2. Modify the debug and packaging and compiling targets and remove all properties which point to the old resources folder with a property pointing to a new resource folder (you may want to replicate the tasks and name them something else
  3. Then run your modified debug task.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:39:58+00:00Added an answer on May 26, 2026 at 1:39 am

    I would go with Ant. Here’s a good tutorial for you: http://www.androidengineer.com/2010/06/using-ant-to-automate-building-android.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have many different NSArray 's stored in .dat files, in the Documents folder
I'm developing an Android game using Canvas element. I have many graphic elements (sprites)
I have many PowerPoint presentations that I need to be able to add to
I have many many files in a folder, and I want to process them
I have many directories with files in them. I want to create a comma
We have many projects with several files inside each. Files can be checked in
I have many flags that I want to store them in an integer, so
I have many text files containing bank transactions in the middle of them. Each
I have many buttons in my layout and they work well. I want to
I have many MySQL statements that are running under MySQL 4, but not MySQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.