Problems encountered during Android Development -- WARNING: Application does not specify an API level requirement in Android! Solution, requirement

Source: Internet
Author: User

Problems encountered during Android Development -- WARNING: Application does not specify an API level requirement in Android! Solution, requirement

During the trial run of the Andorid project on the mobile phone, we found that the Console printed"WARNING: Application does not specify an API level requirement! "Such warning information is shown in:

  

Although the normal operation of the project is not affected, you still need to find out the cause and check the cause of the warning on the Internet. It turns out that the Min SDK Version is not specified in the AndroidManifest. xml file during project creation.

Solution: Modify the AndroidManifest. xml file and add the following code between <manifest> </manifest>:

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

Use android: minSdkVersion to specify the minimum SDK version for running this Android app. minSdkVersion = "8" indicates the Android 2.2 version used. android: targetSdkVersion indicates the SDK version for compiling this Android app, targetSdkVersion = "21" indicates the version of Android 5.0.1 used.

After adding the configuration items for the <uses-sdk/> node, if the <application> </application> node does not set the android: allowBackup attribute, set android for the <application> node: allowBackup = "true" attribute; otherwise, the <application> node will receive a warning message. The modified AndroidManifest. the content of the xml file is as follows:

<? Xml version = "1.0" encoding = "UTF-8"?> <Manifest xmlns: android = "http://schemas.android.com/apk/res/android" package = "me. gacl. ui" android: versionCode = "1" android: versionName = "1.0"> <! -- Use android: minSdkVersion to specify the minimum SDK version of the Android app. minSdkVersion = "8" indicates the Android 2.2 version used: targetSdkVersion indicates that the SDK version of the Android Application targetSdkVersion = "21" indicates the version of Android 5.0.1 used --> <uses-sdk android: minSdkVersion = "8" android: targetSdkVersion = "21"/> <application android: label = "@ string/app_name" android: icon = "@ drawable/ic_launcher" android: allowBackup = "true"> <activity android: name = "FrameLayoutTest" 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>

After the AndroidManifest. xml file is modified in this way, no warning message will appear when running the Android project.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.