Reputation: 21639
I am creating two versions of my app; the full and the demo one. The full one has over 500 sound files in the raw folder. The demo one idealy should import everything from resources but I only want about 33% of the sound files otherwise the size of the demo one will be the same as the full one.
Is there a way to do this using a library project, so that I don't have to clone almost everything as that would make much more difficult to edit the code or image resources later?
I've used the library project before, but I am not sure if I can partially import resources. One idea is not to import resources at all but only the code from the library, while the resources would be duplicated in these two versions.
Upvotes: 0
Views: 106
Reputation: 15137
You probably couldn't do this with Eclipse, but if you build your app using ant you could probably do this with only one main project without using library project.
Here's how I would do it, setup the project so that you can build the app from the command line. e.g. 'ant release' should build the and sign the release app for you automatically.
Next add two new targets in your build.xml file: 'release_full', 'release_demo'. The 'release_demo' target will first clean the raw folder, and then copy the demo sound files in there and then proceed with the normal 'release' build. The 'release_full' target does the same thing, but it will copy all the sound files into raw folder. In the new targets, make sure you rename the apk file once they're build. e.g. rename from MyApp.apk to 'MyAppFull.apk' or 'MyAppDemo.apk'.
When you're ready to distribute your app, issue 'ant release_demo' and 'ant release_full' and you will have two apks, one for demo, and one for release.
Of course, you need to setup the build.xml such that it knows where to find your sound files that are not part of your Android source folder, where to copy them into. All these can be defined by ant property task.
To copy files use <copy> task, to delete files use <delete> task.
Upvotes: 1