如何将项目升级为使用AddAndroidXSupport来增强Android应用支持?

2026-04-02 13:551阅读0评论SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计332个文字,预计阅读时间需要2分钟。

如何将项目升级为使用AddAndroidXSupport来增强Android应用支持?

FeatureRequestAndroidQ(目前处于Beta测试)将仅支持AndroidX支持库。此外,React Native 0.60版本将默认包含AndroidX支持。

FeatureRequestAndroidQ(currentlyinBeta)willonlysupportAndroidXsupp Feature Request

Android Q(currently in Beta) will only support AndroidX support libraries. Additionally React Native 0.60 will include default AndroidX support. As such, it would be helpful to have a new version with AndroidX support soon after RN 60 is released. We may want to do this as a major version bump in case we want to keep supporting the current version with minor fixes.

Edit: Google Play Services latest version uses AndroidX as well

如何将项目升级为使用AddAndroidXSupport来增强Android应用支持?

Why it is needed

Once AndroidX support lands in RN 60, there will be a need for all RN packages to add AndroidX support as you can only have one or the other and Jetifier doesn't work with 3rd party dependencies.

Possible implementation

Use Jetifier to migrate support lib to androidx if we're already on support lib version 28.0.0

Code sample

Migration Guide

该提问来源于开源项目:react-native-device-info/react-native-device-info

It does look that way.

1cd android && ./gradlew :app:dependencies

might show why it was still linking against the support libraries. My guess is the library name or version or similar?

In fact I think these library names: github.com/react-native-community/react-native-device-info/blob/master/android/build.gradle#L44 may need the treatment of replacing the entire library name as I mentioned myself in the jetifier docs.

If someone is willing to try a patch to the build.gradle here that implements that, it would likely fix it and be useful for others as a PR and/or as a patch to use via patch-package until we can do a release

本文共计332个文字,预计阅读时间需要2分钟。

如何将项目升级为使用AddAndroidXSupport来增强Android应用支持?

FeatureRequestAndroidQ(目前处于Beta测试)将仅支持AndroidX支持库。此外,React Native 0.60版本将默认包含AndroidX支持。

FeatureRequestAndroidQ(currentlyinBeta)willonlysupportAndroidXsupp Feature Request

Android Q(currently in Beta) will only support AndroidX support libraries. Additionally React Native 0.60 will include default AndroidX support. As such, it would be helpful to have a new version with AndroidX support soon after RN 60 is released. We may want to do this as a major version bump in case we want to keep supporting the current version with minor fixes.

Edit: Google Play Services latest version uses AndroidX as well

如何将项目升级为使用AddAndroidXSupport来增强Android应用支持?

Why it is needed

Once AndroidX support lands in RN 60, there will be a need for all RN packages to add AndroidX support as you can only have one or the other and Jetifier doesn't work with 3rd party dependencies.

Possible implementation

Use Jetifier to migrate support lib to androidx if we're already on support lib version 28.0.0

Code sample

Migration Guide

该提问来源于开源项目:react-native-device-info/react-native-device-info

It does look that way.

1cd android && ./gradlew :app:dependencies

might show why it was still linking against the support libraries. My guess is the library name or version or similar?

In fact I think these library names: github.com/react-native-community/react-native-device-info/blob/master/android/build.gradle#L44 may need the treatment of replacing the entire library name as I mentioned myself in the jetifier docs.

If someone is willing to try a patch to the build.gradle here that implements that, it would likely fix it and be useful for others as a PR and/or as a patch to use via patch-package until we can do a release