我试图让一个基本的 hello world 程序在我的手机上运行,但是当我指定 14 时,Android Studio 一直恢复到 minSDK 级别 20。这是我正在使用的过程:
-启动Android Studio 0.8.2
-选择新项目
- 选择最低 SDK 作为 API 14:Android 4.0
-选择空白 Activity
-新项目现已开放。我的 android 设备,运行 4.4.2 API 19 已插入。
-选择“运行应用”
-“选择设备”对话框打开,显示我的 android 设备,但显示兼容性为 No, minSdk(API 20, L preview)!= deviceSdk(API19)
以下是我的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”。
有什么想法吗?谢谢!
最佳答案
“L”开发者预览版是一个特殊的雪花,它打破了版本管理的所有常规规则。 :-(
除非您是一位经验丰富的 Android 开发人员,专门在“L”上进行测试,否则请将 compileSdkVersion
更改为 19
之类的内容(注意:可能需要您下载 SDK Platform for API SDK 管理器中的级别 19)并将 targetSdkVersion
更改为 19
。
Changing 'compileSdkVersion' to 14 results in an error, "failed to find target android-14".
您需要在 SDK 管理器中下载 API Level 14“SDK 平台”。
关于android - 如何更改 Android Studio 中的 minSdk 版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25222183/