简体   繁体   中英

Not able to use new resource identifiers in Android with targetSdkVersion defined in manifest

I'm developing an Android application that I'd like to be compatible with 1.5 (SDK version 4). I'm testing the application on 2.2 (SDK version 8). To do this, I'm including in the manifest file the line

<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8" />

I thought this would allow me to use the newest manifest elements and APIs, but I'm getting a compile error whenever I try to use them. For example, I try to define the element installLocation to allow the app to be installed on the SD card, but Eclipse gives me the error

No resource identifier found for attribute 'installLocation' in package 'android'

Is there something else I have to do to get this to work? If I can't get this to work, what benefit is defining targetSdkVersion ?

Make sure that you are using building against the android 2.2 jars. Right click on your Eclipse project, choose, properties, go down to Android and make sure the correct sdk is selected.

通过在Eclipse中编辑项目属性来更改构建目标,并选择至少具有API级别8的目标:(“我正在测试2.2上的应用程序(SDK版本8)”)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM