Android Studio:失败 [INSTALL_FAILED_OLDER_SDK]
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24465289/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android Studio : Failure [INSTALL_FAILED_OLDER_SDK]
提问by Vahe Muradyan
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
今天我下载了 Android Studio v 0.8.0 beta。我正在尝试在 SDK 17 上测试我的应用程序。Android Studio 错误Failure [INSTALL_FAILED_OLDER_SDK]
这是我的 android 清单
<?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
似乎android studio在build.gradle中使用了配置。这里是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.+'
}
回答by Vova K.
There are my config to support L and old versions of android:
有我的配置来支持 L 和旧版本的 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.
并且可以在旧版本的 android 上安装您的应用程序。
回答by HocineHamdi
Do those changes in build.gradle
file in the wear module
build.gradle
在磨损模块中的文件中进行这些更改
compileSdkVersion 20
targetSdkVersion 20
So the final wear/build.gradlecontent will be:
所以最终的wear/build.gradle内容将是:
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:+'
}
回答by Daroath
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
我使用的是 Android Studio Beta 版本 0.8.1,我遇到了同样的问题。我现在通过将 AVD(我正在使用 Genymotion)更改为 API 19 来解决我的问题。这是我的 build.gradle 文件
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!
希望这有帮助!
回答by Illegal Argument
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.
我遇到了同样的问题,并通过使用 sdk 管理器下载 api level 20 并更改指向android-L 的每个字符串来解决它。我这样做是因为我没有 kitkat 设备并且不想使用模拟器。
请参阅图像下载标记的。
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'])
}
回答by ThorinOakenshield
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
如前所述,切换到 build 19 是此处建议的路线,直到 v20 被“修复”。这个线程帮助我解决了这个问题,但似乎这里也发布了类似的答案。https://code.google.com/p/android/issues/detail?id=72840
回答by user3383999
Change file AndroidManifest.xml
更改文件 AndroidManifest.xml
<uses-sdk android:minSdkVersion="19"/>
<uses-sdk android:minSdkVersion="14"/>
回答by Kris Utter
<uses-sdk android:minSdkVersion="19"/>
In AndroidManifest.xml
worked for me on Android Studio(Beta)0.8.2.
在AndroidManifest.xml
Android Studio(Beta)0.8.2 上为我工作。
回答by Al-Kathiri Khalid
Failure [INSTALL_FAILED_OLDER_SDK]
失败 [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.
基本上意味着安装失败,因为目标位置(AVD/设备)的 SDK 版本比targetSdkVersion
您的应用程序中指定的版本旧。
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
这是从 eclipse 到现在 Android Studio 0.8-.8.6 的常见错误
Things to avoid in Android Studio (As for now)
在 Android Studio 中要避免的事情(至于现在)
- Avoid Strings instead set API level/Number
- Avoid generalizing dependencies + be specific
- 避免字符串而是设置 API 级别/编号
- 避免泛化依赖项 + 要具体
回答by youssef
in the AndroidManifest.xml file change the user-sdk to older version
<uses-sdk android:minSdkVersion="19"/>
在 AndroidManifest.xml 文件中将 user-sdk 更改为旧版本
<uses-sdk android:minSdkVersion="19"/>
回答by Goutham
After a lot of research i found the solution for this huge error which i was struggling for 2 days.
经过大量研究,我找到了解决这个巨大错误的方法,我为此苦苦挣扎了 2 天。
Instead of changing the minSdkVerison & targetSdkVersion in build.gradle
而不是更改 build.gradle 中的 minSdkVerison & targetSdkVersion
Just open the Manifest file and use this
只需打开清单文件并使用它
<uses-sdk android:minSdkVersion="17" android:targetSdkVersion="21"/