Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

android

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?

like image 612
Mike Avatar asked Jul 09 '10 14:07

Mike


People also ask

What is the difference between compileSdkVersion and targetSdkVersion?

compileSdkVersion is the version of the compiler used in building the app, while targetSdkVersion is the "API level that the application targets".

What is minimum SDK and target SDK in Android?

The min sdk version is the earliest release of the Android SDK that your application can run on. Usually this is because of a problem with the earlier APIs, lacking functionality, or some other behavioural issue. The target sdk version is the version your application was targeted to run on.

What is target SDK version used for?

android:targetSdkVersion — Specifies the API Level on which the application is designed to run. In some cases, this allows the application to use manifest elements or behaviors defined in the target API Level, rather than being restricted to using only those defined for the minimum API Level.

What is Android Target version?

The Target Android Version (also known as targetSdkVersion ) is the API level of the Android device where the app expects to run. Android uses this setting to determine whether to enable any compatibility behaviors – this ensures that your app continues to work the way you expect.


2 Answers

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.

like image 82
Robby Pond Avatar answered Oct 05 '22 22:10

Robby Pond


Change the build target by editing the project properties in Eclipse, and choose a target with at least API Level 8: ("I'm testing the application on 2.2 (SDK version 8)").

like image 22
Jorgesys Avatar answered Oct 05 '22 22:10

Jorgesys