简体   繁体   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?

I have searched SO thoroughly and couldn't find the reason for the error that I am facing. 我已经进行了彻底的搜索,找不到我所遇到的错误的原因。

Things I did: 我所做的事情:

  1. I changed the compileSdkVersion & targetSdkVersions in app gradle file from 26 to 23. 我将应用程序gradle文件中的compileSdkVersion和targetSdkVersions从26更改为23。
  2. I clicked sync now. 我现在点击同步。
  3. It resulted in 7 error messages making my manifest file go haywire. 它导致了7条错误消息,使我的清单文件陷入混乱。

Snippets: 片段:

  1. My App Gradle file after changing the compile,target sdk versions to 23 from 26 将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 is installed already Android SDK Platform 23已安装

已安装SDK 23

  1. Error Messages (affecting Manifest file) due to change of SDK version from 26 to 23 由于SDK版本从26更改为23而导致的错误消息(影响清单文件)

错误讯息

  1. Manifest file 清单文件

 <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> 

How to fix this ? 如何解决呢?

I changed the compileSdkVersion & targetSdkVersions in app gradle file from 26 to 23. 我将应用程序gradle文件中的compileSdkVersion和targetSdkVersions从26更改为23。

That is not a good plan, particularly if you plan to ship via the Play Store, as you will have to raise the values again shortly . 这不是一个好计划,尤其是如果您打算通过Play商店发货时,因为您很快就会再次提高这些值

How to fix this ? 如何解决呢?

The best solution is to move your compileSdkVersion and targetSdkVersion back to 26. 最好的解决方案是将您的compileSdkVersiontargetSdkVersion回26。

Otherwise, fix the errors reported by the compiler. 否则,请修复编译器报告的错误。

In this case, your manifest has android:roundIcon on <application> , and android:roundIcon did not exist back with API Level 23. You are saying, via compileSdkVersion 23 , that you want to compile using the rules that existed for API Level 23, and that includes not using things that did not exist back then. 在这种情况下,您的清单在<application>上具有android:roundIcon ,而android:roundIcon在API级别23下不存在。您是说通过compileSdkVersion 23 ,要使用针对API级别23的规则进行编译。 ,其中包括不使用当时不存在的东西。 So, get rid of android:roundIcon from your actual manifest. 因此,从您的实际清单中摆脱android:roundIcon

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android compileSdkVersion 23, minSdkVersion 15, targetSdkVersion 23 - Android compileSdkVersion 23, minSdkVersion 15, targetSdkVersion 23 Android:对compileSdkVersion + targetSdkVersion 23感到困惑 - Android: confused about compileSdkVersion + targetSdkVersion 23 将targetSDKVersion从19更改为26时出错的Android应用 - Error Android app when change targetSDKVersion from 19 to 26 如果targetSdkVersion = 23(棉花糖),当minSdkVersion &lt;targetSdkVersion时,Android皮棉不会显示错误 - Android lint not showing errors when minSdkVersion < targetSdkVersion, if targetSdkVersion=23 (Marshmallow) 为什么清单文件中有 compileSdkVersion? - Why is there compileSdkVersion in manifest file? 更新 compileSDKVersion 和 targetSDKVersion 时,Android 构建失败 - Android build is failing when updates to compileSDKVersion and targetSDKVersion 将compedSdkVersion从23更改为21 - Change compileSdkVersion From 23 to 21 在 Android 上扑动 compileSdkVersion 和 targetSdkVersion - flutter compileSdkVersion and targetSdkVersion on Android Android清单文件-targetSDKVersion - Android Manifest file- targetSDKVersion 使目标targetSdkVersion和compileSdkVersion到26后,我的android apk大小增加了500kb - After making target targetSdkVersion and compileSdkVersion to 26, my android apk size increased by 500kb
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM