46

I got this Froyo (2.2) device that I am using to make an app. When I try to run the app directly to the device it shows an error saying

pkg: /data/local/tmp/com.example.HelloWorldProject
Failure [INSTALL_FAILED_OLDER_SDK]

and in another window there's an error saying

Unable to attach test reporter to test framework or test framework quit unexpectedly

What seem to make the said errors?

EDIT:

AndroidManifest.xml

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

    <uses-sdk
            android:minSdkVersion="8"
            android:targetSdkVersion="17"/>

    <application
            android:allowBackup="true"
            android:debuggable="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            >
        <activity
                android:name="com.example.HelloWorldProject.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>
Abel Callejo
  • 13,779
  • 10
  • 69
  • 84

15 Answers15

33

After I changed

defaultConfig {
    applicationId "com.example.bocheng.myapplication"
    minSdkVersion 15
    targetSdkVersion 'L' #change this to 19
    versionCode 1
    versionName "1.0"
}

in build.gradle file.

it works

chengbo
  • 5,789
  • 4
  • 27
  • 41
  • 4
    This is really the correct answer. The targetSdkVersion should not be using 'L' for devices. The OP should accept this as the correct answer. Found some many answers that failed to address this issue. – Qin Zhengquan Jul 21 '14 at 08:30
  • @QinZhengquan where is this defaultConfing I don't see it in AndroidManifest.xml, where can I find this? – iqueqiorio Nov 28 '14 at 05:17
  • 1
    @iqueqiorio in `build.gradle` file – chengbo Nov 28 '14 at 06:18
29

This error

Failure [INSTALL_FAILED_OLDER_SDK]

Means that you're trying to install an app that has a higher minSdkVersion specified in its manifest than the device's API level. Change that number to 8 and it should work. I'm not sure about the other error, but it may be related to this one.

hichris123
  • 10,145
  • 15
  • 56
  • 70
10

Besides checking the right minSdkVersion in build.gradle, make sure you have installed all necessary tools and correct SDK Platform for your preferred Android Version in SDK Manager. In Android Studio klick on Tools -> Android -> SDK Manager. Then install at minimum (for Android 2.2 without emulator):

  • Android SDK Tools
  • Android SDK Platform-tools
  • Android SDK Build-tools (latest)
  • Android 2.2 (API 8)
    • SDK Platform
    • Google APIs

This is what worked for me.

illnr
  • 750
  • 9
  • 13
4

Make sure you don't have a minSdkVersion set in your build.gradle with a value higher than 8. If you don't specify it at all, it's supposed to use the value in your AndroidManfiest.xml, which seems to already be properly set.

Scott Barta
  • 79,344
  • 24
  • 180
  • 163
3

Just removing uses-sdk tag works for me for such problems.

Veedrac
  • 58,273
  • 15
  • 112
  • 169
1

Failure [INSTALL_FAILED_OLDER_SDK] basically means that the installation has failed due to the target location (AVD/Device) having an older SDK version than the targetSdkVersion specified in your app.

N/B Froyo 2.2 API 8

To fix this simply change

targetSdkVersion="17" to targetSdkVersion="8"

cheers.

alkathirikhalid
  • 887
  • 12
  • 18
1

Make Sure the Select Run/Debug Configuration is wear or mobile as per your installation in android studio...

Nirav Bhavsar
  • 2,133
  • 2
  • 20
  • 24
1

Failure [INSTALL_FAILED_OLDER_SDK]

For Sumsung note3 I just edit the AndroidManifest.xml file and add the following code:

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17"/>
Raein Hashemi
  • 3,346
  • 4
  • 22
  • 33
0

In your manifest file package attribute is set to com.test.helloworld however your activity class is under different package. Change your MyActivity class package to com.example.helloworld

Hellboy
  • 1,052
  • 6
  • 12
0

I fixed this problem.The device system version is older then the sdk minSdkVersion。 I just modified the minSdkVersion 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

This is because you mobile has older sdk version than your application..!!! It means your application need sdk version suppose Lollipop but you mobile has version kitkat.

0

Fix your gradle file the following way

defaultConfig {
    applicationId "package.com.app"
    minSdkVersion 8 //this should be lower than your device
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}
meda
  • 45,103
  • 14
  • 92
  • 122
0
In android studio: reduce minSDKversion. It will work...

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "healthcare.acceliant.trianz.com.myapplication"
        minSdkVersion 11
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.1.1'
}
gnganapath
  • 917
  • 12
  • 16
0

Maybe go to File>Project Structure > Modules and Change your Source Compability to a lower version before Ive done this, Ive changed in build.gradle mindSdk and tragetSdk from 31 to 30. Now I can use the Emulator without problems

ProAslan
  • 73
  • 10
-1

Change file AndroidManifest.xml

<uses-sdk android:minSdkVersion="19"/>

<uses-sdk android:minSdkVersion="14"/>