0

I imported the CardView Sample app using Android Studio with Import Sample option from GitHub. No issues.

However, When I tried to run this sample app on my Android device running Android 4.2, I am getting error as per below screenshot:

enter image description here

I Google the issue and found this link: Installation error: INSTALL_FAILED_OLDER_SDK

As per the answers in that link, I need to make targetSdkVersion to match my device OS version So, I tried to change the targetSdkVersion as below (Android 4.2 = API Level 17)

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

But even after this change I am unable to run this app on my android device.

Any hint on how to fix this?

Community
  • 1
  • 1
AADProgramming
  • 6,077
  • 11
  • 38
  • 58
  • Are you installing app on "real" device or AVD? – Aspicas Sep 04 '15 at 11:43
  • its device (Samsung Galaxy device running on Android 4.2)! – AADProgramming Sep 04 '15 at 11:44
  • Android Studio or Eclipse? – Aspicas Sep 04 '15 at 11:46
  • Please read the question once, I mentioned all these details. Its Android Studio! – AADProgramming Sep 04 '15 at 11:48
  • 1
    I read the question, I ask because you are mixing eclipse code on Android Studio, to change `targetSdkVersion` on Android Studio You need change on `build.gradle`file, do not use `` on `AndroidManifest.xml`. To implement `CardView` on Android Studio you only need add that code on `Build.gradle` file: `compile 'com.android.support:cardview-v7:22.0.0'` and compile again your app, but first Unistall your app on your device and try again. – Aspicas Sep 04 '15 at 11:58
  • If you need help to change `Build.Gradle` file, tell me and I will post an answer – Aspicas Sep 04 '15 at 12:00
  • @Aspicas It is fixed! All i need was do clean build and run the app once again! Thanks for your input though! – AADProgramming Sep 04 '15 at 12:02

1 Answers1

0

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

 apply plugin: 'com.android.application'

android {
compileSdkVersion 17
buildToolsVersion "17.1.0"

defaultConfig {
    applicationId "com.example.daroath.actionbar"
    minSdkVersion 14
    targetSdkVersion 17
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}
halfer
  • 19,824
  • 17
  • 99
  • 186
Mayuri
  • 489
  • 3
  • 11