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 above
What 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?
Relevant log output
Code of Conduct
What happened?
Environment
Issue
Android builds fail with the following error:
Root Cause
The library's
android/src/main/AndroidManifest.xmlcontains apackageattribute which is deprecated in newer Android Gradle Plugin versions (7.0+). The namespace should be defined inbuild.gradleinstead.Workaround
Manually remove the
packageattribute fromnode_modules/react-native-onesignal/android/src/main/AndroidManifest.xmland usepatch-packageto 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 thebuild.gradlefile.Steps to reproduce?
What did you expect to happen?
The library should build successfully without requiring manual modifications to the
AndroidManifest.xmlfile. Thenamespaceshould be defined only inbuild.gradle, following Android Gradle Plugin 7.0+ best practices.React Native OneSignal SDK version
5.4.1
Which platform(s) are affected?
Relevant log output
Code of Conduct