Search code examples
androideclipse-pluginandroid-studioandroid-4.2-jelly-beanandroid-sdk-tools

Android Studio : Compiling with API level 16


I was trying to compile an Android with API level 16. However, I am getting following errors. Is it possible to compile an app with API level 16 using android studio or Eclipse now ?

Error:(50, 21) No resource found that matches the given name: attr android:actionModeShareDrawable'

Error:(6, 21) No resource found that matches the given name: attr 'android:paddingEnd'

Error:(11, 21) No resource found that matches the given name: attr 'android:layout_marginEnd'

Error:(10, 21) No resource found that matches the given name: attr 'android:paddingStart'.

Error:(6, 21) No resource found that matches the given name: attr 'android:paddingEnd'

Error:(24, 21) No resource found that matches the given name: attr 'android:layout_marginStart'.

Error goes like that.. Total 118 errors..

Following is what I have installed in my Android Studio:

  1. Android SDK Tools 24.0.2
  2. Android SDK Platform-Tools 21
  3. Android SDK build tools 20
  4. Android 4.1.2 (API 16).

I have set Compile with : API level 16 also.

Is there anything else required to compile it with API level 16 ? How can I get rid of these errors? Could someone help me with this ? Thank you so much.

EDIT:

File build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

build.gradle for app:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 16
    buildToolsVersion '20'
    defaultConfig {
        applicationId "com.mtes.sidek.techer"
        minSdkVersion 10
        targetSdkVersion 16
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:21.0.3'
}

SDK Manager:

enter image description here

Compile with settings:

enter image description here


Solution

  • AppCompat v21 builds themes that require the new APIs provided in API 21 (Android 5.0). To compile your application with AppCompat, you must also compile against API 21. The recommended setup for compiling/building with API 21 is a compileSdkVersion of 21 and a buildToolsVersion of 21.0.1 (which is the highest at this time - you always want to use the latest build tools).Also if you want to compile with 16 then compile Appcompat using this compile 'com.android.support:appcompat-v7:19.1.+'