I know that I can have Eclipse build for 1.5 and 1.6 SDKs for different screen densities if I have the following snippet in AndroidManifest.xml
<supports-screens android:anyDensity="false"/>
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4" />
and if I set up my assets in the following manner in res
folder:
/res/drawable-hdpi-v4
/res/drawable-ldpi-v4
My default.properties has the followi开发者_开发百科ng line:
# Indicates whether an apk should be generated for each density.
split.density=false
# Project target.
target=android-4
This setup allows me to create 1.5 and 1.6 builds in Eclipse IDE, but fails with the following error when I try to do a command line build.
Buildfile: build.xml
[setup] Project Target: Android 1.6
[setup] API level: 4
[setup] WARNING: Attribute minSdkVersion in AndroidManifest.xml (3) is lower than the project target API level (4)
Target "resource-src" does not exist in the project "<project-name>". It is used from target "compile".
This error comes up whether I use build.xml generated by 1.5 SDK or the 1.6 SDK (with -resource-src, -aidl targets).
I think that on commandline the build.xml is defaulting to 1.5 SDK, I dont know any way of making it work with 1.6+ SDKs and would appreciate any thoughts, comments on this.
My goal is have one script that with will compile for all Android SDKs while supporting different screen densities.
Thanks
Ok, I should have answered this myself a while back considering I solved this issue. The problem here was Google changing the <android-home>/tools/ant/main_rules.xml
file which is used for commandline compiles in Android 2.2 I think.
The answer is simple actually, I just updated my Android SDK to latest and in my build.xml file, I overwrote the targets defined in <android-home>/tools/ant/main_rules.xml
that I needed to modify. This is the recommended way according to Google and now all my apps are built from Android 1.5 onwards.
精彩评论