如何在Android Studio中更改minSdk版本? [英] How to change the minSdk version in Android Studio?
问题描述
我正在尝试在手机上运行一个基本的hello world程序,但是当我指定14时,Android Studio会继续恢复到minSDK级别20.这是我正在使用的过程:
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:
-启动Android Studio 0.8.2
-选择新项目
-选择最低SDK作为API 14:Android 4.0
-选择空白活动
-新项目现已开放.我的运行4.4.2 API 19的android设备已插入.
-选择运行应用"
-选择设备"对话框打开,显示我的Android设备,但兼容性显示为否,minSdk(API 20,L预览)!= deviceSdk(API19)
-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)
以下是我的build.gradle:
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'])
}
将'compileSdkVersion'更改为14会导致错误无法找到目标android-14".
Changing 'compileSdkVersion' to 14 results in an error, "failed to find target android-14".
有什么想法吗?谢谢!
推荐答案
"L"开发者预览版是一种特殊的雪花,它打破了版本管理的所有常规规则.:-(
The "L" Developer Preview is a special snowflake that breaks all the normal rules for version management. :-(
除非您是经验丰富的Android开发人员,专门针对"L"进行测试,否则将 compileSdkVersion
更改为类似 19
的名称(注意:可能需要您下载SDK平台的API从SDK Manager进入19级),然后将 targetSdkVersion
更改为 19
.
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
.
将'compileSdkVersion'更改为14会导致错误无法找到目标android-14".
Changing 'compileSdkVersion' to 14 results in an error, "failed to find target android-14".
您需要在SDK Manager中下载API级别14"SDK平台".
You need to download the API Level 14 "SDK Platform" in the SDK Manager.
这篇关于如何在Android Studio中更改minSdk版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!