android - 如何更改 Android Studio 中的 minSdk 版本?

标签 android android-studio

我试图让一个基本的 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/

相关文章:

android - 无法重新加载 AVD 列表 : For input string: "" Could not load wear device Error in android studio

android - 复选框覆盖自定义 ListView 中的触摸

java - 查看全局类变量?

android - 为 Spinner 创建一个 setError()

android - Android Studio代码显示红色。但它运行成功

android-studio - 断言失败: bool 表达式不能为null?如何解决这个问题?

android - 相对布局滚动问题

java - 如何在 Android Lollipop 中使用 WebView 上传文件?

java - Android Studio 上的 NoClassDefFoundError R$string

安卓工作室错误 : Execution failed for task ':app:processDebugManifest'