android - 如何在保持向后兼容性的同时将 foregroundServiceType 添加到库 list ?

标签 android android-manifest android-10.0

我的图书馆项目有一个定位服务,根据 Android Q 要求,它设置了 android:foregroundServiceType="location" list 中的属性。当应用程序模块使用我的库并针对 API 级别 28 进行编译时,它会失败并出现以下错误:

AndroidManifest.xml:57: AAPT: error: attribute android:foregroundServiceType not found.

我的库如何保持与旧版本的兼容性,同时确保该功能适用​​于 Android Q?

最佳答案

在迁移到 Androidx 后,我遇到了同样的错误和更新compileSdkVersion从 28 日到 29 日,我的问题得到了解决。所以请做这些改变,你可以得到你的解决方案

关于android - 如何在保持向后兼容性的同时将 foregroundServiceType 添加到库 list ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56579320/

相关文章:

android - 如何渲染从 onPreExecute() 中的 AsyncTask 获取的 ArrayList<ImageView>?

android - Activity.startLockTask() 从一个 Activity 到另一个 Activity

Android Deeplink pathPrefix 属性被忽略

Android 10 默认短信应用对话框未显示

java - 如何在 Android 10 中打开 Activity (传入 voip 调用)

android - 使 subview 比其父 View 更宽

android - SQLite Android 从其他字段更新字段

android - 为什么在android :configChanges ="orientation|screenSize" is in manifest file时不调用生命周期 Activity 方法

android - Gradle list 合并丢失的属性

Android 10(api 29)camera2 api回归与广角相机