开发者

Android: 2.1 AND install on SD-card feature for 2.2+ users

I want my Android application to support 2.1 (Eclair), but I also want it to support installation to sd-card for 2.2 (and later) users. I'm using MOTODEV, and I created a new 2.1 project. I tried adding android:installLocation="preferExternal" to my manifest file, but it doesn't work because it's not supported in 2.1. How can i make my application support SD-installation and at the same time support 2.1?

EDIT: I see I can use android:installLocation="preferExternal" even for 2.1 and older builds according to http://developer.android.com/guide/appendix/install-location.html#Compatiblity. The trick is, as CommonsWare stated below, to change the build tar开发者_Go百科get to 2.2.

The problem now is that Eclipse/Motodev won't let me run or debug on virtual devices that are older than the build. It simply doesn't list the device. I tried tricking it by changing the build target, choosing an older device in run/debug configurations, and then changing build target back, but I just got the following message in the console:

Preferred AVD 'eclair_hvga' is not compatible with the project target 'Android 2.2'. Looking for a compatible AVD...


Set your build target (Android section of project properties in MOTODEV Studio for Android) to 2.2. This causes you to use 2.2 rules for compilation, and android:installLocation should be recognized. Then, test your app on 2.1 and 2.2.


So is this bug in eclipse ? When you set build target to higher version then android:minSdkVersion it wont allow you to run on minSdkVersion. This answer is incorrectly accepted, when it don’t work in Eclipse (that was in question).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜