I'd like to support Android 2.1 devices, but also would like to enable users to move my app to the SD card if they have Android 2.2+
开发者_StackOverflow社区The attribute for that is android:installLocation="auto"
How can I still support 2.1 while enable this attribute for 2.2+?
EDIT: I've set it with build 2.1 and I get a compilation error and I cannot launch my app. The reason I don't want to increase the build target to 2.2 is because if I do that and the app gets installed on 2.1, a bunch of exceptions are thrown and it crashes. I want to make sure that the app works perfectly on 2.1. For an example of what I mean, please see NoSuchMethodError: String.isEmpty
An exact solution for you is in Android Manual.
It can be done, set your minimum API level to 7 and your target API level to 8, more details are in the Dev Guide.
精彩评论