gpt4 book ai didi

android - 无法解析符号 'MediaSessionCompat'

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:29:51 28 4
gpt4 key购买 nike

我无法导入 MediaSessionCompat。用于导入整个 android.support.v4.media 库的导入语句不会出现在 Android Studio“IntelliSense”中,并且它无法解析其中任何内容的符号。

我是否必须进行某种额外的配置才能获得此导入,例如在应用 build.gradle 中?

最佳答案

将这些添加到您的依赖项并同步 Gradle:


AndroidX 之前

implementation 'com.android.support:support-compat:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'

后 AndroidX

implementation 'androidx.core:core:1.8.0'
implementation 'androidx.media:media:1.6.0'

注意来自官方文档:

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.We recommend using the AndroidX libraries in all new projects. You should also consider migrating existing projects to AndroidX as well.

关于android - 无法解析符号 'MediaSessionCompat',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52019841/

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