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
| ||||||||||||||||||||
comments |
24 Answers
activeoldestvotesup 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.
| ||||||||||||||||||||
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:+' }
| ||||||||||||||||
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 fileapply 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!
| ||||||||
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']) }
| ||||||||||||||||||||
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"/
| ||||
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
| ||||
a comment |
up vote2down vote | <uses-sdk android:minSdkVersion="19"/> In AndroidManifest.xmlworked for me on Android Studio(Beta)0.8.2.
| |||
add a comment |
up vote2down vote | in the AndroidManifest.xml file change the user-sdk to older version <uses-sdk android:minSdkVersion="19"/>
| ||
add a comment |
up vote2down vote | Change file AndroidManifest.xml<uses-sdk android:minSdkVersion="19"/> <uses-sdk android:minSdkVersion="14"/>
| |||
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 }
| |||
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
| ||
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
| |||
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
| ||
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.
| ||
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.
| ||
add a comment |
up vote0down vote | Another way to support Android L is to use custom lpreviewproperty 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 lpreviewproperty for Android L and without it for previous versions.
| ||
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" }
| ||
add a comment |
up vote0down vote | your device older than minSDK, edit minSdkVersionin build.gradle
| ||
add a comment |
up vote0down vote | Try changing you sdk min version<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="19" />
| |||
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.
| ||
add a comment |
up vote0down vote | In my case, just restart Android Studio!
| ||
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
| ||
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" }
| ||
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.gradlefile: 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
| |||
add a comment |
5 Answers
activeoldestvotesup 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.
| ||||||||||||
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>
| ||
add a comment |
up vote2down vote | Changeandroid { compileSdkVersion 'android-L' buildToolsVersion '20.0.0' to android { compileSdkVersion 21 buildToolsVersion '21.0.2' Note android-Lis in single quotes but 21isn't. 21is an integer and not a string.
| ||
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.
| ||
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. |
相关文章推荐
- 62. Unique Paths
- Terrasolid Suite v015-v016 for Microstation CONNECT, V8i, V8 & for Windows platforms 1CD
- 《iOS Human Interface Guidelines》——Undo and Redo
- AudioQueue 音频队列实现录音和播音
- android4.4的文件管理器documentsui源码解析
- 关于build-tools位置不一致问题
- 调用顺序正确,仍然出现Android异常:requestFeature() must be called before adding content
- UGUI之Canvas
- Android Download机制详解(一)DocumentUI部分
- UITabbarController更改点击的图片与文字颜色以及更改tabbar的视图颜色
- CodeForces 283A Cows and Sequence 树状数组
- MiniUI之(一)简介
- Error:failed to find Build Tools revision 23.0.2
- Retrieving a Key by a Value--by Tim O'Brien 整理by博主
- Qt工程文件中QT -= core gui与Config-=qt的区别
- AddressBookUI AddressBook Contacts简单使用
- iOS获取UUID,并使用keychain存储
- Spoj 2713 Can you answer these queries IV 水线段树
- 简单的EasyUI登录界面
- jsp:EL之$(pageContext.request.contextPath)和$(requestScope.contextPath)区别