android - 支持 Android Q 中的库依赖项

标签 android

为了针对 Android Q 测试我的应用,我安装了 Android Studio 3.5 (canary) 并更新了我的构建配置,如下所述:

https://developer.android.com/preview/setup-sdk

但是我该如何处理支持库依赖项呢?下面的都是红色的,因为:

This support library should not use a different version (28) than the compileSdkVersion (29)

dependencies {
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:gridlayout-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    testImplementation 'junit:junit:4.12') {
        transitive = true;
}

在 Google 发布新的支持库之前,我是否可以让它们保持原样?我遇到构建错误,但我不确定它是否与此有关。

最佳答案

支持库将不会在 28 之后更新。您需要迁移到 androidx。

参见 support library documentation它说:

Note: With the release of Android 9.0 (API level 28) there is a new version of the support library called AndroidX which is part of Jetpack. The AndroidX library contains the existing support library and also includes the latest Jetpack components.

You can continue to use the support library. Historical artifacts (those versioned 27 and earlier, and packaged as android.support.*) will remain available on Google Maven. However, all new library development will occur in the AndroidX library.

关于android - 支持 Android Q 中的库依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55236947/

相关文章:

android - adb shell 中的 screenshot 和 screencap 有什么区别?

android - 如何在 native android 应用程序中使用 WebRTC + Pubnub Api 作为视频聊天客户端

java - 约束连接/绳索/线以避免拉伸(stretch)

android - 如何更改抽屉导航的 TextView 中图标和文本的颜色?

Android ScrollView,在软键盘上的操作栏下

java - 安卓 JNI OutOfMemoryError

android - 设备设置独立字体大小

java - 尝试将字符串数组从一个类传递到另一个类时出现 NullPointerException

android - 在运行时创建 NinePatch/NinePatchDrawable

Android- 聊天应用程序 - 转换字符串中的编辑框表情符号 ;) 格式以保存在数据库中