Reputation: 51
I am new in Android Studio. I just Develop an application for Card View , its working in Android L. But it is not working in lower version.
When I try to execute in lower version getting an error
Failure [INSTALL_FAILED_OLDER_SDK]
Can any one please tell me what to do for run this application in Lower version
build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
apply plugin: 'com.android.application'
repositories {
jcenter()
}
dependencies {
compile "com.android.support:cardview-v7:21.0.2"
}
List<String> dirs = [
'main',
'common',
'template'] process
android {
compileSdkVersion 21
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 21
targetSdkVersion 21
}
sourceSets {
main {
dirs.each { dir ->
java.srcDirs "src/${dir}/java"
res.srcDirs "src/${dir}/res"
}
}
androidTest.setRoot('tests')
androidTest.java.srcDirs = ['tests/src']
}
}
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.cardview"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".CardViewActivity"
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>
Upvotes: 2
Views: 389
Reputation: 18243
Your device tell you that its API level is too low.
Let's take a look at your building configuration:
Your AndroidManifest.xml file specifies:
<uses-sdk android:minSdkVersion="7"
android:targetSdkVersion="21" />
Your Gradle build file specifies:
minSdkVersion 21
targetSdkVersion 21
This is contradictory.
You should use:
minSdkVersion 7
targetSdkVersion 21
(And actually you could get rid off the AndroidManifest.xml uses-sdk
directive.)
Upvotes: 1