0

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.
  2. I clicked sync now.
  3. It resulted in 7 error messages making my manifest file go haywire.

Snippets:

  1. My App Gradle file after changing the compile,target sdk versions to 23 from 26
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

Sdk 23 installed already

  1. Error Messages (affecting Manifest file) due to change of SDK version from 26 to 23

Error Messages

  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 ?

1 Answers1

2

I changed the compileSdkVersion & targetSdkVersions in app gradle file from 26 to 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.

How to fix this ?

The best solution is to move your compileSdkVersion and targetSdkVersion back to 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. So, get rid of android:roundIcon from your actual manifest.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Say if I have to create an application which targets only Marshmallow (ver 23), should I uninstall the Oreo or Nougat SDK which is already installed ? – Ganesh Ramachandran Feb 20 '18 at 13:05
  • @GaneshRamachandran: "I have to create an application which targets only Marshmallow (ver 23)" -- since that is not possible, my guess is that you and I are using different terms. "should I uninstall the Oreo or Nougat SDK which is already installed ?" -- that is up to you and is unrelated to your problem. – CommonsWare Feb 20 '18 at 13:10