-
Notifications
You must be signed in to change notification settings - Fork 378
Description
What happened?
Environment
- react-native-onesignal version: 5.3.1
- React Native version: 0.81.5
- Android Gradle Plugin version: 8.x
- Platform: Android
Issue
Android builds fail with the following error:
Incorrect package="com.onesignal.rnonesignalandroid" found in source AndroidManifest.xml: /path/to/node_modules/react-native-onesignal/android/src/main/AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="com.onesignal.rnonesignalandroid" from the source AndroidManifest.xml
Root Cause
The library's android/src/main/AndroidManifest.xml contains a package attribute which is deprecated in newer Android Gradle Plugin versions (7.0+). The namespace should be defined in build.gradle instead.
Workaround
Manually remove the package attribute from node_modules/react-native-onesignal/android/src/main/AndroidManifest.xml and use patch-package to persist the change.
Expected Behavior
The library should build successfully on modern Android Gradle Plugin versions without requiring manual patches.
Suggested Fix
Remove the package="com.onesignal.rnonesignalandroid" attribute from the AndroidManifest.xml file, as the namespace is already properly defined in the build.gradle file.
Steps to reproduce?
1. Create a React Native 0.81.5 project
2. Install `react-native-onesignal@5.3.1`
3. Attempt to build for Android
4. Build fails with the error aboveWhat did you expect to happen?
The library should build successfully without requiring manual modifications to the AndroidManifest.xml file. The namespace should be defined only in build.gradle, following Android Gradle Plugin 7.0+ best practices.
React Native OneSignal SDK version
5.4.1
Which platform(s) are affected?
- iOS
- Android
Relevant log output
Code of Conduct
- I agree to follow this project's Code of Conduct