-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Android] Upcoming changes for libraries in React Native 0.73 #671
Comments
@cortinico Does removing the |
I tried to patch react-native-bootsplash package. it's work (RN 0.71.8) |
@MasonLe2497 What about versions older than that? RN 0.71 is already the latest available release. What about versions before 0.69? |
EDIT: I take that back – I messed up while pointing to the new local build of Repack in RN67.x project. In RN67.x the build of the test app using Repack version with this change fails with the following bug (which, tbh, makes sense): In the generated - import com.callstack.repack.ScriptManagerPackage;
+ import undefined.ScriptManagerPackage; This then leads to the next error: |
@cortinico which min RN version can use this change? |
Hey everybody, I double-checked the compatibility of this change with older versions of React Native, and unfortunately, it's not compatible with RN67.x. Sorry for the confusion 😞 . I already updated my old comment with details of what exactly fails. This looks like a breaking change, and libraries should release a new major version targeting RN71 and higher. |
@RafikiTiki thanks for coming back with the feedback. This is likely due to the RN CLI not able to parse namespace for RN 0.67, as it was added for CLI v10 which targets RN 0.71: react-native-community/cli@5fbb536 If we want to stay compatible with RN version policy, we likely need to backport this to 0.70 at least. We could go further I guess, but I'd need @cortinico let me know if this even makes sense. |
@thymikee We develop an SDK for React Native and leaving all these versions behind can be a bit risky. |
For completeness, by the time 0.73 will be out, 0.72 and 0.71 will also be out which supports the And yes, removing |
Nice! Thanks for starting this @cortinico . The good part is that it helps to reduce the app size, especially for big projects 🎉 |
* task(SDK-3753) - Removes manifest entry for CTBackgroundJobService - No longer required as it is fixed in v6.2.0 * task(SDK-3752) - Updates Example app * task(SDK-3752) - Adds support for ctv6.2.0 - Updates versions - Removes all xiaomi related code * task(SDK-3752) - Fixes a typo in CHANGELOG.md * task(SDK-3752) - Adds back package name for max compatibility with RN versions react-native-community/discussions-and-proposals#671 (comment) * task(SDK-3752) - Updates CHANGELOG.md
Hi, |
* AGP support react-native-community/discussions-and-proposals#671 * remove package value react-native-community/discussions-and-proposals#671
This issue is due to: react-native-community/discussions-and-proposals#671 And will reintroduce a warning for old libraries
With React Native 0.73 Android Gradle Plugin 8 is now supported If 8 and up the java toolchain should take care of the compatibility of java versions between dependencies Release: react-native-community/discussions-and-proposals#671 Fixes Error: 'compileDebugJavaWithJavac' task (current target is 17) and 'compileDebugKotlin' task (current target is 11) jvm target compatibility Seen when building for Android Co-authored-by: Alex Risch <[email protected]>
TL;DR
React Native 0.73 will depend on Android Gradle Plugin (AGP) 8.x. This will require all the libraries to specify a
namespace
in theirbuild.gradle
file. We added a compatibility layer for libraries that haven't specified anamespace
, but please consider updating your libraries nonetheless.Details
I'd like to share some of the upcoming changes that will happen in 0.73, which is still a bit far, but we'd rather start earlier rather than later.
React Native 0.73 will depend on Android Gradle Plugin (AGP) 8.x, which brings a lot of improvements for Android apps but also a series of notable changes.
Most importantly:
namespace
in their build.gradle file.Specifically, the last change is a breaking change and will make libraries that are not specifying a namespace incompatible with React Native 0.73 (your project won't build).
Support for namespace was added in AGP 7.3.x, which ships with React Native 0.71. Libraries that published a new version with a
namespace
declared for 0.71 or 0.72 don't need further update. So we invite library authors to do those changes as soon as possible so by the time 0.73 is out, most of the apps are adapted.What you need to change
Library authors will have to update their
android/build.gradle
file as follows:android { + namespace = "com.example.mylibrary" ... }
and remove the package definition from their
AndroidManifest.xml
:Compatibility Layer
We added a compatiblity layer inside React Native 0.73, that will make sure that
namespace
is configured for each libraries, even if you don't update the library. This will make sure 0.73 works also with older libraries that are not receiving may updates.Still consider updating your library to keep up to date with the Android best practices.
Further reading
Official Google documentation on namespaces is here.
Please update your libraries whenever possible, adding the
namespace
declaration and let us know if this is creating any issues for you.The text was updated successfully, but these errors were encountered: