android - 更新支持库的最佳方式

标签 android android-studio android-gradle-plugin android-support-library android-appcompat

到现在(2017 年 11 月 30 日)谷歌已经发布了 android 支持库版本 27.0.2 和 Android Api 版本 27(预览版)。现在我的应用程序有 Target version 25Build tool version 25.0.3Compile 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/

相关文章:

Android工作室: Segmentation fault while trying to deploy app on Android device

android - 在android项目和库中使用支持库(Android Studio)

java - 从适配器调用插页式广告时出现 Android java.lang.SecurityException 错误

android - 无法在android的 ListView 中获取点击的行号

android - 由服务扩展的类 Activity 问题

android - Gradle错误- “Error:arm64-v8a|x86|x86_64|mips|mips64'类型为 'abiType'。”

添加 fragment 后,Android Studio 分解了我的 build.gradle 文件

Android Studio - 在 Gradle 中为 ManifestPlaceholders 分配多个值

javascript - 从 Android 应用程序运行 tor.so "net::ERR_NAME_NOT_RESOLVED"

android - 无法使用双值更新我的热图 scichart