Reputation: 121
I am just beginning to use Eclipse for Android applications. I have installed Eclipse 3.5.2 and Java 5 AVD is Android 2.1 API 7
My initial Hello Android program ran fine but will not run again.
getting the following error:
[2010-07-25 09:47:31 - HelloAndroid] WARNING: Application does not specify an API level requirement!
[2010-07-25 09:47:31 - HelloAndroid] Device API version is 7 (Android 2.1-update1)
searched the forums but could only find a refernece to manifest file to be sure following was set:
<uses-sdk android:minSdkVersion="3" />
my manifest file does not contain that line:
<?xml version="1.0" encoding="utf-8" ?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.helloandriod" android:versionCode="1" android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".HelloAndroid" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I have checked the adv mgr and it is set to 7 In Eclipse i went to properties -> Android and set it to 7
get same warnings
Upvotes: 12
Views: 27488
Reputation: 2609
you have to specify the API level in your code and it should be in a single line.
uses-sdk android:targetSdkVersion="19" android:minSdkVersion="4".
Target should be latest one. It might help you as it worked for me. Thanks
Upvotes: 0
Reputation: 9150
The manifest should only contain a single element, it's an error to use more than once.
In ADT 17, we have a new lint warning which detects and reports this problem:
$ lint --version
lint: version 17
$ lint --show MultipleUsesSdk
MultipleUsesSdk
---------------
Summary: Checks that the <uses-sdk> element appears at most once
Priority: 6 / 10
Severity: Error
Category: Correctness
The <uses-sdk> element should appear just once; the tools will *not* merge the
contents of all the elements so if you split up the atttributes across
multiple elements, only one of them will take effect. To fix this, just merge
all the attributes from the various elements into a single <uses-sdk>
element.
More information: http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
Upvotes: 2
Reputation: 38252
It appears that there is a bug in the Android SDK Tools revision 16 that requires the correct ordering of the uses-sdk
tags. If you're using both targetSdkVersion
and minSdkVersion
, order them as follows:
<uses-sdk android:targetSdkVersion="10" /> <!-- before minSdkVersion -->
<uses-sdk android:minSdkVersion="7" /> <!-- after targetSdkVersion -->
Reversing the order will give the warning message and pop up the device selection window. I therefore recommend writing this in a single line:
<uses-sdk android:targetSdkVersion="10" android:minSdkVersion="7" />
Upvotes: 8
Reputation: 5946
You should also include
<uses-sdk android:minSdkVersion="7" />
in your manifest file, if it is not already there. It's not clear from your question, but seems that it isn't.
For future reference about API levels, see this page
Upvotes: 10
Reputation: 42849
Well, if Eclipse is, for whatever reason, not generating that line for you, by all means you can add it yourself.
Add the line:
<uses-sdk android:minSdkVersion="3" />
to your manifest, right before the ending manifest tag.
Upvotes: 35