0

I am learning material design which Google introduced recently. I am using Android Studio for writing code of my application.

When I build the project then it doesn't not show any errors in my code but at the last I get everytime same error message.

Failure [INSTALL_FAILED_OLDER_SDK]

I have seen many threads on stackoverflow Failure [INSTALL_FAILED_OLDER_SDK] Android-L but that didn't answer to my question.

I am testing an app on Android 4.4.4. I don't want to compile the project against API 19. I want to have material theme of my application as well I want to use new api whichever added in Android L.

How this can be possible to compile the project against Android L for lower android versions ?

build.gradle

apply plugin: 'com.android.application'

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

    defaultConfig {
        applicationId "multipanelayout.example.com.multipanelayoutdemo"
        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'])
}

values - styles.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
        <!-- Customize your theme here. -->
    </style>

</resources>

values-21 - styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="AppTheme" parent="android:Theme.Material.Light">
    </style>
</resources>

Thanks in advance.

Community
  • 1
  • 1
N Sharma
  • 33,489
  • 95
  • 256
  • 444

1 Answers1

0

As explained in the other SO answers, and in the official doc at http://developer.android.com/preview/setup-sdk.html.

You have to use:

minSdkVersion 'L'

in your build.gradle and you have to run the app in device with Android-L or an emulator with Android-L.

You are using minSdkVersion 15 and it is the reason of your error.

It is not a bug, but this is because these APIs are not final. It is a way to prevent installing the apps on a final API 21.

The material theme, currently it is only for api>=21 (and you are using the values-v21 folder) so the lower android versions will continue to run with the Holo theme.

The best way (without workarounds) to test it, is to use 2 different flavors, to test you app with api-19 and a device with 4.4.x, and with api-21 and a device with android-L.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
  • Ah ok but how google did in their google io 2014 app ? – N Sharma Sep 14 '14 at 11:19
  • The google io in the google play isn't with API-L and doesn't use Material Theme. You can check the source code in gihtub. They used 2 different flavors. Only the preview flavor use this theme. – Gabriele Mariotti Sep 14 '14 at 11:23
  • so once they will confirm all api then we developers can make material design for lower android os level also right ? – N Sharma Sep 14 '14 at 11:28
  • please explain - It is a way to prevent installing the apps on a final API 21. or it should be like : a way to prevent installing the apps below android L ? – N Sharma Sep 14 '14 at 11:56