Skip to content

Commit

Permalink
fix: use AndroidManifest.xml for older RN versions (#431)
Browse files Browse the repository at this point in the history
### Summary

The React Native CLI relies on the filename `AndroidManifest.xml` to be
able parse the package name. But we were using
`AndroidManifestLegacy.xml` instead which broke the lib for older RN
versions (AGP 7). This change makes it so that we use
`AndroidManifest.xml` for older RN versions and `AndroidManifestNew.xml`
for newer RN versions.

Fixes #429

### Test plan

- Create an app with RN 0.68 and install the library without these
changes - see that `yarn android` fails
- Create an app with RN 0.68 and install the library with these changes
- see that `yarn android` succeeds
- Create an app with latest RN and install the library with these
changes - see that `yarn android` succeeds
  • Loading branch information
satya164 authored Aug 1, 2023
1 parent 44df3f9 commit ace6101
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ def supportsNamespace() {
android {
if (supportsNamespace()) {
namespace "com.<%- project.package -%>"
} else {

sourceSets {
main {
manifest.srcFile "src/main/AndroidManifestDeprecated.xml"
manifest.srcFile "src/main/AndroidManifestNew.xml"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.<%- project.package -%>">
</manifest>
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.<%- project.package -%>">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>

0 comments on commit ace6101

Please sign in to comment.