5

I'm new to Android and I'm using the Android Studio. I've created a new project just to show the Hello World! but I can't get it working on the AVD because of this error: Failure [INSTALL_FAILED_OLDER_SDK].

I already searched for the answer and I know it's something about the build.gradle and the minSdkVersion but any of the answers worked for me.

This is my AndroidManifest.xml :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.scoelli.test" >

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MyActivity"
            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>

And this is my build.gradle :

apply plugin: 'com.android.application'

android {
    compileSdkVersion 'android-L'
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.example.scoelli.test"
        minSdkVersion 8
        targetSdkVersion 'L'
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

I would appreciate not only the answer but the explanation.

Thank You!

Pantera96c
  • 75
  • 1
  • 1
  • 9
  • possible duplicate of [What does "Failure \[INSTALL\_FAILED\_OLDER\_SDK\]" mean in Android Studio?](http://stackoverflow.com/questions/20622255/what-does-failure-install-failed-older-sdk-mean-in-android-studio) – martin clayton Oct 18 '14 at 09:42

4 Answers4

6

Unless you know you want to be using the Android L developer preview with your application, do not target and compile with it. It is still very much a preview release, and it appears as though applications targeting and compiling for the preview cause this error with any non-L device.

Update these lines in your build.gradle to stick with the latest stable release (Android 4.4, API 19):

android {
    compileSdkVersion 19

    defaultConfig {
        targetSdkVersion 19
    }
}
Bryan Herbst
  • 66,602
  • 10
  • 133
  • 120
  • 3
    This works, but if you have a `styles.xml` file in the `../res/values-v21` that references `android:Theme.Material.Light.DarkActionBar` it kicks out `Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light.DarkActionBar'.` – Cora Jul 13 '14 at 04:27
1

I think projects with

 compileSdkVersion 'android-L'

cannot be installed in other Android versions right now. I might be wrong there but if you're not doing anything specific to the L preview SDK, just set the compile version to one of the official ones. Same goes for the targetSdk.

You can choose those in the Create Project wizard.

MysticMagicϡ
  • 28,593
  • 16
  • 73
  • 124
fweigl
  • 21,278
  • 20
  • 114
  • 205
1

I fixed this problem. I just modified the compileSdkVersion from android_L to 19 to target my nexus 4.4.4.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.2'
    }
}
apply plugin: 'com.android.application'

repositories {
    jcenter()
}

android {
    **compileSdkVersion 'android-L'** modified to 19
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.antwei.uiframework.ui"
        minSdkVersion 14
        targetSdkVersion 'L'
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    **compile 'com.android.support:support-v4:21.+'** modified to compile 'com.android.support:support-v4:20.0.0'
}

how to modified the value by ide. select file->Project Structure -> Facets -> android-gradle and then modified the compile Sdk Version from android_L to 19

sorry I don't have enough reputation to add pictures

Ant小波
  • 57
  • 4
0

If you get this error when compiling Adobe AIR mobile app - just correct "minSdkVersion" this line in the application descriptor xml file:

<uses-sdk android:minSdkVersion="13" android:targetSdkVersion="15"></uses-sdk> 
Deyan Vitanov
  • 695
  • 5
  • 18