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:
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?
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'
}
}
}
Related
This is my gradle file where I make the changes but anything I do with SDK 28 doesn't help me but when I change it to 27. It works. Please help me to make it work with SDK 28. Thank you.
//This is my app gradle(Module:base)
apply plugin: 'com.android.feature'
android {
compileSdkVersion 28 //Change is made here
baseFeature true
defaultConfig {
minSdkVersion 16
targetSdkVersion 28 //Change is made here
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
api 'com.android.support:appcompat-v7:28.0.0-beta01'//Change is made here
api 'com.android.support.constraint:constraint-layout:1.1.2'
application project(':app')
feature project(':project')
}
//If I change the SDK version to 27, it works. I really want to find out how to make it work in SDK version 28
//Thank you for helping
Click Tools > SDK Manager.
In the SDK Platforms tab, select Android P Preview.
In the SDK Tools tab, select Android SDK Build-Tools 28-rc2 (or higher).
Click OK to begin install.
Make sure you have Android Studio 3.1 or higher.
I'm trying to refactor my code to androidX. To do so android asked me to update the compiled version to at lease 28. So I changed my compiled version to compileSdkVersion 28 in bulid.gradle.
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 17
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
But once I sync project I'm unable to download the platform plugins and the following error shows up in build window.
Failed to find target with hash string 'android-28' in: /Users/work/Library/Android/sdk
Your compile version should be android-p. They're using the version name now.
compileSdkVersion 'android-P'
And target should be just P
targetSdkVersion 'P'
See here to know how to set up Android P SDK.
Edit:
If your getting an error/warning "minSdkVersion (21) is greater than targetSdkVersion (1)" this is done on purpose, see here.
As Android P is still Preview, the 'P' in the targetSdkVersion will work as a version 1. Once it's out of preview it will be replaced with the usual 28. For now, to fix this you'd need to raise the minSdkVersion to also 'P'.
I have 4.4.4 (19) Android and I can't use instant run with new version (2.3) of Android Studio:
Why did they do it? It worked on the version before this one.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
...
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId ***
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary true
renderscriptTargetApi 25
renderscriptSupportModeEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
***
}
(emphasis mine)
In Android Studio 2.3 and higher, Instant Run significantly reduces the time it takes to update your app with code and resource changes. After deploying your app to a target device running Android 5.0 (API level 21) or higher, you can click Apply Changes to push certain code and resource changes to your running app without building a new APKāand, in some cases, without even restarting the current activity
Android | Instant Run
Note You can still set the targetSdkVersion and compileSdk version to the latest API levels without affecting the majority of your code. (minus any deprecated methods)
If you still not find solution then just go one way.Probably it work for you.
Update your sdk with Platform tools whatever Device you want to run.
Instant need platform tools.
Like nougat need 24.
Thanks hope this will help you.
I am trying to get a basic hello world program running on my phone, however Android Studio keeps on reverting to minSDK level 20, when I specified 14. Here is the process I am using:
-Start Android Studio 0.8.2
-Select New Project
-Select Minimum SDK as API 14: Android 4.0
-Select Blank Activity
-The new project is now open. My android device, running 4.4.2 API 19 is plugged in.
-Select "Run app"
-The "Choose Device" dialog opens, shows my android device, but shows compatibility as No, minSdk(API 20, L preview)!= deviceSdk(API19)
The following is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-L'
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.example.victor.myapplications"
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'])
}
Changing 'compileSdkVersion' to 14 results in an error, "failed to find target android-14".
Any ideas? Thanks!
The "L" Developer Preview is a special snowflake that breaks all the normal rules for version management. :-(
Unless you are an experienced Android developer specifically testing on "L", change compileSdkVersion to something like 19 (note: may require you to download the SDK Platform for API Level 19 from the SDK Manager) and change targetSdkVersion to 19.
Changing 'compileSdkVersion' to 14 results in an error, "failed to find target android-14".
You need to download the API Level 14 "SDK Platform" in the SDK Manager.
try this:
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.example.victor.myapplications"
minSdkVersion 14
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
If the target keep giving to you this problem try putting a lower version like CommonsWare said !
So I know that many other people had this problem, but mine is a little different. I've tried running my app on an LG G2 with Android 4.4.4, and a Note 3 with Android 4.4.2, but neither worked. I have installed the API 18, 19, and 20 SDKs.
Failure [INSTALL_FAILED_OLDER_SDK]
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-L'
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.ween.control"
minSdkVersion 8
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:appcompat-v7:19.+'
}
You can't test an Android-L app on a device with lower API.
Take a look here.
You need to make sure your dependencies are configured targeting the same sdk (also make sure the sdk is supported for the dependency).
As of version .11, the gradle plugin now uses the new manifest merger tool by default which you can use to avoid conflicting configurations when merging manifests from your dependencies while building by specifying <uses-sdk tools:node="replace" /> in your AndroidManifest.xml file.
http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger
credit goes to Eddie Ringle
I was having a similar issue but my device sdk was 19 and it was looking for it to be 20. I changed the sdk from the file > Project Structure > SDK to 19 also I noticed when I was running it had the wear value selected in the top toolbar so I switched that to mobile and Voila.