gpt4 book ai didi

Android Gradle 设置

转载 作者:行者123 更新时间:2023-11-29 00:18:11 24 4
gpt4 key购买 nike

我对 gradle 版本控制设置非常困惑。我找到了 some information关于这个构建系统,但没有任何地方写过关于版本控制的细节。您能解释一下这些选项的含义吗?

compileSdkVersion
buildToolsVersion
minSdkVersion
targetSdkVersion

minSdkVersion 是最明显的,因为它意味着我们想要支持的最小 API,例如14(Android >= 4.0)。

targetSdkVersion:

This attribute informs the system that you have tested against the target version and the system should not enable any compatibility behaviors to maintain your app's forward-compatibility with the target version.

我不太明白。

我的情况是支持 API 15 的设备。正确的设置是什么?
我在某处读到目标应该尽可能高,Android Studio 也告诉我,但是当我设置它并尝试在 Nexus 5 上运行时,我得到:

Failure [INSTALL_FAILED_OLDER_SDK]

我的build.gradle

android {
compileSdkVersion 'android-L'
buildToolsVersion "20.0.0"

defaultConfig {
applicationId "my.package.name"
minSdkVersion 14
targetSdkVersion 'L'
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

最佳答案

根据官方文档: http://developer.android.com/preview/setup-sdk.html#createProject如果您想尝试新功能,您应该使用这些值:

compileSdkVersion is set to 'android-L'
minSdkVersion is set to 'L'
targetSdkVersion is set to 'L'

这是失败的原因 [INSTALL_FAILED_OLDER_SDK]。

如果您不需要 android-L,我建议使用这些值:

defaultConfig {
applicationId "my.package.name"
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}

据说,这里描述了一个非官方的解决方法(无论如何我建议你不要使用它)

Failure [INSTALL_FAILED_OLDER_SDK] Android-L

关于Android Gradle 设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24972283/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com