Wednesday, November 28, 2012

How To Change The API Level Of An Android Project

During testing, you might encounter this scenario where you need to test on a different Android Virtual Device with a different API level. For example, in testing the vibrating effect on our weather app, we needed to test this on an actual Android smartphone via USB. The AVD has API level 10 while the Huawei Android smartphone has API level 8. Upon running the project, the Android Chooser window appeared to which the smartphone device was selected as shown in the image below.

Then the following error message occurred in the console tab of Eclipse:

[2012-11-29 12:23:26 - Oz Weather] ERROR: Application requires API version 10. Device API version is 8 (Android 2.2.2).
[2012-11-29 12:23:26 - Oz Weather] Launch canceled!

To get around this is very simple as shown in the following steps below:

1. In Eclipse, go to Project | Properties.
2. In the Properties window de-select the current API level and choose API level 8.

3. Click the Ok button.
4. In the AndroidManifest.xml file look for the code and change 10 to 8

<uses-sdk android:minSdkVersion="10" />

5. Save and run the project.

Related Posts:

Tags: android tutorial


Source : htmlpress[dot]net

0 comments:

Post a Comment