到现在(2017 年 11 月 30 日)谷歌已经发布了 android 支持库版本 27.0.2 和 Android Api 版本 27(预览版)。现在我的应用程序有 Target version 25
,Build tool version 25.0.3
和 Compile sdk version 25
。我计划更新我的支持库以及将 sdk 版本编译为 26。所以我的问题是
1. 支持 lib 版本是否与 android Api 版本相关意味着我没有将 android api 更新到 27,因为它处于预览状态,所以我应该使用支持 lib 26.x.x 还是 27.x.x(最新的)。
2. 我应该使用哪个构建工具版本意味着
最佳答案
获取 API 级别 26。由于 API 27 处于预览模式,因此目前还不稳定。像这样更改您的 Build.gradle 文件并同步您一切顺利。
android {
compileSdkVersion 26
buildToolsVersion "26.0.3"
defaultConfig {
applicationId "Your app ID"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
而且您还必须更新您的依赖项,因为如果您使用旧版本,它们将无法在最新版本中工作。所以这就是 supp lib 与 android API 相关的原因。
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:design:26.1.0'
关于android - 更新支持库的最佳方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47568313/