您的位置:首页 > 产品设计 > UI/UE

INSTALL_FAILED_OLDER_SDK (continue talk about it)

2016-02-18 17:46 731 查看


出自:http://www.ray-world.com/?p=667


Android Studio 0.8.0彻底解决 Failure [INSTALL_FAILED_OLDER_SDK]

2014年9月25日 / RAY / 5条评论

今天好不容易有兴致写了一下午代码,但是到最后准备扔到模拟器上运行的时候,出问题了,android studio提示错误:Failure [INSTALL_FAILED_OLDER_SDK]

这个问题我百度了很久,发现其根本原因在于编译(compile)的SDK版本高于运行时的SDK版本造成兼容性问题。可是,以前在用Eclipse的时候也没遇到过这种情况啊,而且,按理说只要运行的SDK版本高于最低要求(Minimun require)SDK版本就应该是没有问题的。

在网上找了好大一圈,很多都是很早以前的帖子,让删除Manifest.xml里的<uses-sdk >标签,但最新版本的android studio里生成的Manifest根本没有这个标签,这让人着实伤脑筋,好在翻了几页百度之后,终于找到了解决办法:

http://blog.csdn.net/lori_xj/article/details/38589983

总的来说,就是android studio V0.8这个版本默认的最新SDK——android L的问题。只要是用android L(API 20)编译的程序,怎么也不能在其他版本的环境里运行。

最直接的解决办法就是像上面那个链接里说的,进入AndroidStudioProject/ProjectName/app文件夹,用文本打开build.gradle,做如下略微的修改:

apply plugin: ‘com.android.application’

android {

compileSdkVersion 19

buildToolsVersion “19.1.0”

defaultConfig {

applicationId “com.example.ray.myapplication”

minSdkVersion 14

targetSdkVersion 19

versionCode 1

versionName “1.0”

}

buildTypes {

release {

runProguard false

proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’

}

}

}

dependencies {

compile fileTree(dir: ‘libs’, include: [‘*.jar’])

}

没错,就是改了一下编译的SDK版本而已,改成以前的任何一个API版本号都可以。然后再重新编译,就没问题了。

如果你觉得每次新建个Module都需要改一次配置太麻烦的话,还有个最直接、有效、彻底的办法,打开SDK Manager,卸载一切android L(API 20)的东西……毕竟目前这还只是个preview的预览版,不够完善,所以碰到问题是难免的,保守起见,用稍微旧一点的版本,会更好一点。

出自:http://stackoverflow.com/questions/24465289/android-studio-failure-install-failed-older-sdk


Android
Studio : Failure [INSTALL_FAILED_OLDER_SDK]



up
vote55down
votefavorite
12

Today I have downloaded Android Studio v 0.8.0 beta. I am trying to test my app on SDK 17 . Android studio error
Failure
[INSTALL_FAILED_OLDER_SDK]
Here is my android manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.vahe_muradyan.notes" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".Main_Activity"
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>

</manifest>


It seems that android studio uses configurations in build.gradle.Here is build.gradle
apply plugin: 'com.android.application'

android {
compileSdkVersion 'L'
buildToolsVersion "20.0.0"

defaultConfig {
applicationId "com.vahe_muradyan.notes"
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.+'
}




android
gradle

android-studio

shareimprove
this question
asked Jun 28 '14 at 9:04





Vahe Muradyan
5581315

2
Add this code to your AndroidManifest.xml <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17"/> before
<application tag. – Haresh
Chhelana Jun
28 '14 at 9:24
the same error . pkg: /data/local/tmp/com.vahe_muradyan.notes Failure [INSTALL_FAILED_OLDER_SDK] – Vahe
Muradyan Jun
28 '14 at 9:33
which device have you test ? – Haresh
Chhelana Jun
28 '14 at 9:40
Alcatel 7025D . – Vahe
Muradyan Jun
28 '14 at 9:41
SDK version 17 , Android 4.2.1 – Vahe
Muradyan Jun
28 '14 at 9:41
show 9 more
comments


24 Answers

activeoldestvotes

up vote28down
vote
There are my config to support L and old versions of android:
apply plugin: 'com.android.application'

android {
buildToolsVersion "20.0.0"

defaultConfig {
applicationId "com.example.uladzimir_klyshevich.myapplication"
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

productFlavors {
l {
minSdkVersion 'android-L'
targetSdkVersion 'android-L'
compileSdkVersion 'android-L'
}
old {
minSdkVersion 10
targetSdkVersion 20
//TODO comment second line if build is not compiles for "L"
compileSdkVersion 20
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
lCompile 'com.android.support:appcompat-v7:21.+'
oldCompile 'com.android.support:appcompat-v7:19.1.0'
}


As result you will have flavors:

oldDebug oldRelease lDebug lRelease

And can install your application on old versions of android.

shareimprove
this answer
edited Jul
1 '14 at 11:14





Community
1

answered Jun 30 '14 at 10:08





Vova K.
485412

Thanks for providing this :) – animaonline Jun
30 '14 at 20:43
Hmm...for me, this new info just confuses ME even more. I haven't yet even digested what 'Android-L' is. And maybe EVENTUALLY
I might want to have various 'product flavors', but right now, I just want to get one or any set of values to load into my Nexus-7, running v4.4.4. My thought was that Google is now discouraging continuing to use the older '<uses-sdk>' info in the Manifest,
because when I put it there, when using Android-Studio 0.8.1, it flashes on the screen that it intends to IGNORE that info, because presumably, it's getting somewhere else now. – Dave Jul
1 '14 at 23:58
3
Is this meant for mobile/build.gradle or wear/build.gradle? Neither seems to work as the IDE complains "cannot resolve
symbol 'compileSdkVersion'" – Erik
B Jul
2 '14 at 20:56
This is for mobile/build.gradle. Wear is the another project and you can compile his with any other sdk. – Vova
K. Jul
3 '14 at 5:07
1
Its giving an error cannot resolve symbol 'compileSdkVersion' in product flavors. – Ravi Jul
3 '14 at 7:37
show 6 more
comments





up vote11down
vote
Do those changes in build.gradle file in the wear module

compileSdkVersion 20 targetSdkVersion 20

So the final wear/build.gradle content will be:
apply plugin: 'com.android.application'

android {
compileSdkVersion 20
buildToolsVersion "20.0.0"

defaultConfig {
applicationId "your package name"
minSdkVersion 20
targetSdkVersion 20
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.google.android.support:wearable:+'
compile 'com.google.android.gms:play-services-wearable:+'
}


shareimprove
this answer
answered Jul 10 '14 at 22:01





HocineHamdi
1274

Thanks, I had similar issues. Seems that changing the 'L' to 20 in this mysterious build.gradle file solves the issue.
Never thought I'd say this, but I find myself missing Eclipse... – JDS Jul
14 '14 at 16:10
Thanks a lot!! It worked for me... – user1799214 Jul
15 '14 at 8:34
What is the difference between sdk 20 and 'android-L'? – Igor
Ganapolsky Jul
23 '14 at 23:59
You can find in the Build.VERSION_CODES following: public static final int KITKAT = 19; public static final int KITKAT_WATCH
= 20; public static final int L = 10000; – Vova
K. Aug
17 '14 at 7:32
add
a comment
up vote6down
vote
I'm using Android Studio Beta version 0.8.1 and I have the same problem. I now I sold my problem by changing the AVD (I'm using Genymotion) to API 19. and here is my build.gradle file
apply plugin: 'com.android.application'

android {
compileSdkVersion 19
buildToolsVersion "19.1.0"

defaultConfig {
applicationId "com.example.daroath.actionbar"
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}




Hope this help!

shareimprove
this answer
answered Jul 4 '14 at 14:16





Daroath
302212

when you say changing the avd, do you mean the version in the android manifest file? you edited it in a text editor?
what was it before? – barlop Aug
27 '14 at 8:25
no, in android studio the way you change "android sdk" is no more in manifest file, but u change it in "gradle.build"
file instead.As my experience of the error is that when I set my gradle.build file like defaultConfig { applicationId "com.example.daroath.actionbar" minSdkVersion 14 targetSdkVersion 19 versionCode 1 versionName "1.0" } I need to choose an AVD with API19
or higher to run it. – Daroath Aug
28 '14 at 1:13
add
a comment
up vote4down
vote
I ran into the same issue and solved it by downloading api level 20 using sdk manager and changing every string that points to android-L. I did it because I dont have a kitkat device and don't want to
use emulator.

See the image download the marked one.

Here's my build config:
apply plugin: 'com.android.application'

android {
compileSdkVersion 20//changed this from default
buildToolsVersion "20.0.0"

defaultConfig {
applicationId "com.example.subash.test"
minSdkVersion 12//changed this from default
targetSdkVersion 20//changed this from default
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}


shareimprove
this answer
edited Jul
2 '14 at 3:21

answered Jul 2 '14 at 2:03





Illegal Argument
5,90121538

Do you can use Material theme with these config? – Vova
K. Jul
2 '14 at 10:37
for that you will need either emulator or device with material theme – Illegal
Argument Jul
2 '14 at 10:53
Aha! Now I see (said the blind man)! So, now no matter what value I put into that new layout, for 'targetSdkVersion',
Android Studio pops up an error, asking me to first INSTALL that version of the SDK, and to then re-sync the project. SO: The problem is that, even tho my SDK-manager says that all these various SDKs are installed (they always were), that suddenly this new
Android-Studio must be looking in a diff place, to be able to find them. (I don't know the fix yet. Removing all my SDKs from 10 to 20 is NOT recommended, so I'll sit quietly til someone else discovers the needed-tweak.) – Dave Jul
2 '14 at 14:31
@Dave could you explain your problem exactly? the targetsdkversion and the compilesdk version both need to change(no
need to specify app version in manifest in AS) according to what you have. I didnot have a android 4.4L device so I changed it. The above works for me so it should work for you too – Illegal
Argument Jul
2 '14 at 14:37
Sorry...so today, I followed your recipe, and got rid of my 'Android-L' crap, and went back to putting numbered sdk-values
in. Which is causing a different problem, in that now the builds no longer work...it says it can't find any of my earlier-installed numerical sdks. So, I'm thinking it can ONLY find that newly added Android-L sdk, so when I ask for anything older, I get this
other problem. (Sigh.) – Dave Jul
2 '14 at 18:30
show 3 more
comments
up vote3down
vote
After a lot of research i found the solution for this huge error which i was struggling for 2 days.

Instead of changing the minSdkVerison & targetSdkVersion in build.gradle

Just open the Manifest file and use this
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="21"/


shareimprove
this answer
answered May 5 '15 at 10:13





Goutham
414

This solution worked for me. Thank you. – Ashwin
Krishnamurthy Jul
29 '15 at 5:19
add
a comment
up vote2down
vote
As mentioned before switching to build 19 is the suggested route here until v20 is "fixed". This thread helped me solve the issue, but it seems similar answers have been posted here as well.https://code.google.com/p/android/issues/detail?id=72840

shareimprove
this answer
answered Jul 16 '14 at 5:14





ThorinOakenshield
66128

2nd this. I removed v20 and L of build tools and android image and replaced with 19.1 build tools and Level 19. Then
I removed the project and recreated it and now I can run my programs. – wmac Jul
27 '14 at 15:20
add
a comment
up vote2down
vote
<uses-sdk android:minSdkVersion="19"/>


In
AndroidManifest.xml
worked
for me on Android Studio(Beta)0.8.2.

shareimprove
this answer
edited Aug
6 '14 at 13:33





VMAtm
13.7k124057

answered Aug 6 '14 at 13:13





KrisAllenU
10923

add
a comment
up vote2down
vote
in the AndroidManifest.xml file change the user-sdk to older version
<uses-sdk
android:minSdkVersion="19"/>


shareimprove
this answer
answered Nov 10 '14 at 11:11





youssef
172

add
a comment
up vote2down
vote
Change file AndroidManifest.xml
<uses-sdk android:minSdkVersion="19"/>
<uses-sdk android:minSdkVersion="14"/>


shareimprove
this answer
edited Mar
2 '15 at 10:55





MysticMagicϡ
14.9k64064

answered Jul 18 '14 at 7:37





user3383999
804

add
a comment
up vote1down
vote
The real issue is that with vanilla Android Studio v 0.8 beta, it only installs/recognize SDK 20 which is android L. In order to target another complieSDK you need to install it via the SDK manager. Once it is set, you can then change the compileSDK to a lower
version and it should work.

you may also want to restrict the compatibility library, it needs to be restricted from using the latest version of the library so change the dependecy to something like :
compile('com.android.support:appcompat-v7:19.1.0') {
// really use 19.1.0 even if something else resolves higher
force = true
}


shareimprove
this answer
edited Aug
2 '14 at 3:14

answered Aug 2 '14 at 3:05





Ajibola
9461321

add
a comment
up vote1down
vote
Failure [INSTALL_FAILED_OLDER_SDK] basically means that the installation has failed due to the target location (AVD/Device) having an older SDK version than the targetSdkVersion specified in your app.

FROM*************
apply plugin: 'com.android.application'


android {
compileSdkVersion 'L' //Avoid String change to 20 without quotes
buildToolsVersion "20.0.0"

defaultConfig {
applicationId "com.vahe_muradyan.notes"
minSdkVersion 8
targetSdkVersion 'L' //Set your correct Target which is 17 for Android 4.2.2
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.+' // Avoid Generalization


// can lead to dependencies issues remove +

}

TO*************
apply plugin: 'com.android.application'


android { compileSdkVersion 20 buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.vahe_muradyan.notes"
minSdkVersion 8
targetSdkVersion 17
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.0.0'


}

This is common error from eclipse to now Android Studio 0.8-.8.6 Things to avoid in Android Studio (As for now)

Avoid Strings instead set API level/Number
Avoid generalizing dependencies + be specific

shareimprove
this answer
answered Aug 18 '14 at 9:54





Al-Kathiri Khalid
1063

add
a comment
up vote1down
vote
I fixed this problem. I just modified the compileSdk Version from android_L to 19 to target my nexus 4.4.4.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.2'
}
}
apply plugin: 'com.android.application'

repositories {
jcenter()
}

android {
**compileSdkVersion 'android-L'** modified to 19
buildToolsVersion "20.0.0"

defaultConfig {
applicationId "com.antwei.uiframework.ui"
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'])
**compile 'com.android.support:support-v4:21.+'** modified to compile 'com.android.support:support-v4:20.0.0'
}


how to modified the value by ide.

select file->Project Structure -> Facets -> android-gradle and then modified the compile Sdk Version from android_L to 19

sorry I don't have enough reputation to add pictures

shareimprove
this answer
edited Oct
18 '14 at 6:30

answered Oct 18 '14 at 2:51





Ant小波
173

add
a comment
up vote1down
vote
I initially went into the SDK Manager and updated all that it had set to update.

I also added in the SDK version for the version of Android I had on the Droid I had...Version 2.3.4(10)

I don't think that really fixed anything, and after a Android Studio restart as recommended after the SDK installs, I changed the minSdkVersion to 8 in the build.gradle file

I was then able to download the application to my Droid.
defaultConfig {
applicationId "com.cmcjr.chuck.droid_u"
minSdkVersion 8
targetSdkVersion 20
versionCode 1
versionName "1.0"
}


This is Android Studio installed on Ubuntu 12.04

shareimprove
this answer
answered Oct 22 '14 at 3:26





Chulk Ches
111

add
a comment
up vote0down
vote
Just installed Android Studio v 0.8.1 beta and ran into the same problem targeting SDK 19.

Copied 19 from the adt-bundle to android-studio, changed build.gradle to:

compileSdkVersion 19 targetSdkVersion 19

then project -> app -> open module settings (aka project structure): change compile sdk version to 19.

Now works fine.

shareimprove
this answer
answered Jul 7 '14 at 1:09





johnnie mac
415

add
a comment
up vote0down
vote
Similar to a few posts prior - I went to SDK Manager and uninstalled v20 and version L. Then I installed version 19 and this problem was resolved and I could debug using my android device, no errors.

shareimprove
this answer
answered Jul 18 '14 at 21:47





user3844472
1

add
a comment
up vote0down
vote
Another way to support Android L is to use custom
lpreview
property
for Gradle. For instance:
lpreview = hasProperty('lpreview')

apply plugin: 'com.android.application'

android {
compileSdkVersion lpreview ? "android-L" : 19
buildToolsVersion "20.0.0"

productFlavors { lpreview ? lpreview{} : classic{} }

defaultConfig lpreview ? {} : {
minSdkVersion 14
targetSdkVersion 19
}


Now, you can build your app with:
./gradlew clean
./gradlew -Plpreview assembleDebug


or
./gradlew -Plpreview installLpreviewDebug


This way you can build your app with
lpreview
property
for Android L and without it for previous versions.

shareimprove
this answer
answered Oct 11 '14 at 20:24





Yuriy Yunikov
1,5421028

add
a comment
up vote0down
vote
Check the 'minSdkVersion' in your build.gradle

The default project creates it with the latest API, so if you're phone is not yet up-dated (e.g.minSdkVersion 21), which is probably your case.

Make sure the minSdkVersion value matches with the device API version or if the device has a higher one.

Example:
defaultConfig {
applicationId 'xxxxxx'
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
}


shareimprove
this answer
answered Nov 11 '14 at 15:07





Alécio Carvalho
5,32622036

add
a comment
up vote0down
vote
your device older than
minSDK
,
edit
minSdkVersion
in
build.gradle

shareimprove
this answer
answered Jan 13 '15 at 4:15





meow meo
1,3991217

add
a comment
up vote0down
vote
Try changing you sdk min version
<uses-sdk
android:minSdkVersion="4"
android:targetSdkVersion="19" />


shareimprove
this answer
edited Mar
2 '15 at 10:55





MysticMagicϡ
14.9k64064

answered Oct 16 '14 at 20:39





Guilherme Simão Couto
6718

add
a comment
up vote0down
vote
One more place where minSdkVersion makes a sense is a flavor:
productFlavors {
dev {
minSdkVersion 22
}
prod {
minSdkVersion 9
}
}


minSdkVersion (22) will not install on development devices with API level older than 22.

shareimprove
this answer
answered Mar 30 '15 at 11:39





Vladimir Koltunov
1016

add
a comment
up vote0down
vote
In my case, just restart Android Studio!

shareimprove
this answer
answered Jul 30 '15 at 16:05





Alecs
36338

add
a comment
up vote0down
vote
you need update.

This is my current solution (09/2015).

In Android Studio search.
Menu --> Help --> check for update


Upate and problem solved!!

Good luck

shareimprove
this answer
answered Sep 6 '15 at 1:24





David Hackro
3531414

add
a comment
up vote0down
vote
Just Goto build.gradle(Module:App) and change the minSdkVersion to whatever you are using with emulator.

Example:

defaultConfig { applicationId "com.example.raghu.sample" minSdkVersion 10 targetSdkVersion 23 versionCode 1 versionName "1.0" }

shareimprove
this answer
answered Sep 24 '15 at 4:48





Raghu.k
1

add
a comment
up vote0down
vote
Check the minimum API level inside the build.gradle(module: app)[inside of the gradle scripts]. Thatt should be equal to or lower than the device you use


出自:http://stackoverflow.com/questions/24457831/failure-install-failed-older-sdk-android-l


Failure [INSTALL_FAILED_OLDER_SDK] Android-L



up
vote38down
votefavorite
6

I'm trying to use the new CardView from Android L. I updated everything in the SDK manager, but I keep getting the following error:

Failure [INSTALL_FAILED_OLDER_SDK]

This is my
build.gradle
file:
apply plugin: 'android'

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

defaultConfig {
applicationId "www.thomascbeerten.com.nieuwetests"
minSdkVersion 8
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
// Support Libraries
compile 'com.android.support:support-v4:19.1.0'
compile 'com.android.support:appcompat-v7:19.1.0'
compile 'com.android.support:gridlayout-v7:19.1.0'
compile 'com.android.support:mediarouter-v7:19.1.0'
// compile 'com.android.support:support-v13:19.1.0'
compile 'com.android.support:recyclerview-v7:+'
}




android
android-5.0-lollipop
shareimprove
this question
edited May
29 '15 at 14:27





Qantas 94 Heavy
9,222133954

asked Jun 27 '14 at 17:42





TomCB
1,12321131

add
a comment


5 Answers

activeoldestvotes

up vote53down
voteaccepted
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!).

See my Reddit post about this here, with
a workaround.

shareimprove
this answer
edited Aug
2 '14 at 15:10





nhaarman
29.4k32124173

answered Jun 27 '14 at 17:47





Eddie Ringle
1,3921014

Thanks for the great article! Now I fully understand :) – TomCB Jun
27 '14 at 18:34
26
While this answer may theoretically answer the question, it
is better to include the essential parts of the answer here, and provide the link for reference. – hichris123 Jul
2 '14 at 20:53
so you should follow the guide at reddit.com/r/androiddev/comments/297xli/… and
you'll be able to install on older devices at the same time as compiling with android L – Gabor Sep
22 '14 at 12:31
add
a comment


up vote5down
vote
Once you have the above issues resolved as mentioned by Eddie. You might also run into another error;;
Error:Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light'.


This will be present in your styles.xml . The quick fix is to replace it with the following below:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--<style name="AppTheme" parent="android:Theme.Material.Light">-->
<style name="AppTheme" parent="android:Theme.Holo.Light">
</style>


shareimprove
this answer
answered Jul 16 '14 at 22:29





Skillachie
728718

add
a comment
up vote2down
vote
Change
android {
compileSdkVersion 'android-L'
buildToolsVersion '20.0.0'


to
android {
compileSdkVersion 21
buildToolsVersion '21.0.2'


Note
android-L
is
in single quotes but
21
isn't.
21
is
an integer and not a string.

shareimprove
this answer
answered Oct 28 '14 at 1:33





harikris
3,30832252

add
a comment
up vote0down
vote
When you compile with L it actually makes a change during compilation setting your minsdkversion to L. If you want to use RecyclerView or CardView I would recommend checking out RecyclerViewLib.
RecyclerView and CardView have been moving into this library so that there is no min version L problem. The author also explained in his blog
post how all L related code was removed to make it safe to use.

To add RecyclerViewLb to your project just add the following line to your dependencies in your build.gradle file:
compile 'com.twotoasters.RecyclerViewLib:library:1.0.+@aar'


You then do not want to add the
compile
'com.android.support:recyclerview-v7:+'
to your build.gradle as you will get that through RecyclerViewLib.

shareimprove
this answer
answered Sep 13 '14 at 21:09





MinceMan
3,1232025

add
a comment
up vote0down
vote
I just ran into this problem. This can happen when your min sdk version and built targets are set to a higher API level/OS version than your phone is running. If you're using Android Studio, go to File > Project Structure > and edit relavent settings then Run
again.

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: