0

SOLUTION

In build.gradle file, I set both minSdkVersion and targetSdkVersion to 19 (my Android device's API level).
Also, compileSdkVersion's value must be less than your device's level API.

Issue was:

I cannot install my app I developed in Android Studio, in my Android device (LG G3).
When I try to install my app, this window comes.

When I click OK, the log outputs this.

This was my build.gradle:

apply plugin: 'com.android.application'

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

    defaultConfig {
        applicationId "*AppID*"
        minSdkVersion 15
        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'])
}

What I've tried to do:
1. Modify build.gradle to (Changed compileSdkVersion's value to 15):

apply plugin: 'com.android.application'
android {
    compileSdkVersion 15
        buildToolsVersion "20.0.0"

        defaultConfig {
            applicationId "*AppID*"
            minSdkVersion 15
            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'])
}

2. Clean the project: i.imgur.com/lbdeXGe.png.

avi12
  • 157
  • 1
  • 2
  • 8

2 Answers2

2

Take a look at Failure [INSTALL_FAILED_OLDER_SDK] Android-L

Recently there was a post here regarding the L SDK's incompatibility with prior versions of Android. I've been digging in AOSP repositories for quite a few hours now, and determined that the tools behave this way because they are designed to treat preview platforms differently. If you compile against a preview SDK (android-L), the build tools will lock minSdkVersion and targetSdkVersion to that same API level. This results in the produced application being unable to be installed on devices running older releases of Android, even if your application isn't doing anything specific to L. To make matters worse, the new support libs (CardView, RecyclerView, Palette, etc.) are also locked into the L API level, even though--according to their repository names--they should work on API level 7 just fine (and they do!).

Community
  • 1
  • 1
userM1433372
  • 5,345
  • 35
  • 38
0

The error means your device has an Android version that is less than your specified minSdkVersion. Set the minSdkVersion to the device's version. If that's not possible, there's really nothing you can do other than using a newer device.

Edit: Now seeing userM1433372's answer ... That should be the actual issue. Thought you already tried a different SDK version, but you only changed compileSdkVersion to 15 without changing targetSdkVersion! I would suggest setting both targetSdkVersion and compileSdkVersion to 19 (which is the latest non-preview-version).

0101100101
  • 5,786
  • 6
  • 31
  • 55