簡體   English   中英

當我們將compileSdkVersion和targetSdkVersion從26更改為23時,為什么Android Studio會在清單文件中引發錯誤?

[英]Why does Android Studio throw errors in the manifest file when we change the compileSdkVersion and targetSdkVersion from 26 to 23?

我已經進行了徹底的搜索,找不到我所遇到的錯誤的原因。

我所做的事情:

  1. 我將應用程序gradle文件中的compileSdkVersion和targetSdkVersions從26更改為23。
  2. 我現在點擊同步。
  3. 它導致了7條錯誤消息,使我的清單文件陷入混亂。

片段:

  1. 將compile,目標sdk版本從26更改為23后,我的App Gradle文件
 apply plugin: 'com.android.application' android { compileSdkVersion 26 defaultConfig { applicationId "com.airtelanalytics" minSdkVersion 14 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:26.1.0' compile 'com.android.support:recyclerview-v7:26.1.+' compile 'com.jaredrummler:android-processes:1.1.1' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' } 
  1. Android SDK Platform 23已安裝

已安裝SDK 23

  1. 由於SDK版本從26更改為23而導致的錯誤消息(影響清單文件)

錯誤訊息

  1. 清單文件

 <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" /> <application android:allowBackup="true" android:debuggable="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme" > <activity android:name="com.analyticsdemo.MainActivity" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> 

如何解決呢?

我將應用程序gradle文件中的compileSdkVersion和targetSdkVersions從26更改為23。

這不是一個好計划,尤其是如果您打算通過Play商店發貨時,因為您很快就會再次提高這些值

如何解決呢?

最好的解決方案是將您的compileSdkVersiontargetSdkVersion回26。

否則,請修復編譯器報告的錯誤。

在這種情況下,您的清單在<application>上具有android:roundIcon ,而android:roundIcon在API級別23下不存在。您是說通過compileSdkVersion 23 ,要使用針對API級別23的規則進行編譯。 ,其中包括不使用當時不存在的東西。 因此,從您的實際清單中擺脫android:roundIcon

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM