Android開發中遇到的問題——Android中WARNING: Application does not specify an API level requirement!的解決方案,requirement

來源:互聯網
上載者:User

Android開發中遇到的問題——Android中WARNING: Application does not specify an API level requirement!的解決方案,requirement

今天在手機上調試運行Andorid項目時,發現Console列印出"WARNING: Application does not specify an API level requirement!"這樣的警告資訊,如所示:

  

  雖然不影響項目的正常運行,不過還是要找出原因,上網查了一下出現警告的原因,原來是建立項目時AndroidManifest.xml檔案中沒有指定Min SDK Version

  解決辦法:修改AndroidManifest.xml檔案,在<manifest> </manifest> 之間加入如下代碼:

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

  使用android:minSdkVersion指明運行這個Android應用的最低SDK版本,minSdkVersion="8"表示使用的Android 2.2的版本,android:targetSdkVersion指明編譯這個Android應用的SDK版本,targetSdkVersion="21"表示使用的Android 5.0.1的版本。

  添加<uses-sdk/>節點的配置項之後,如果,<application></application>節點沒有設定android:allowBackup屬性,那麼就為<application>節點設定android:allowBackup="true"屬性,否則<application>節點會出現警告資訊,修改過後的AndroidManifest.xml檔案的內容如下:

<?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">        <!-- 使用android:minSdkVersion指明運行這個Android應用的最低SDK版本  minSdkVersion="8"表示使用的Android 2.2的版本  android:targetSdkVersion指明編譯這個Android應用的SDK版本  targetSdkVersion="21"表示使用的Android 5.0.1的版本   -->  <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>

  AndroidManifest.xml檔案這樣修改過之後,運行Android項目時就不會出現警告資訊了。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.