Skip to content

Commit ace6101

Browse files
authored
fix: use AndroidManifest.xml for older RN versions (#431)
### 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
1 parent 44df3f9 commit ace6101

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

packages/create-react-native-library/templates/native-common/android/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ def supportsNamespace() {
8080
android {
8181
if (supportsNamespace()) {
8282
namespace "com.<%- project.package -%>"
83-
} else {
83+
8484
sourceSets {
8585
main {
86-
manifest.srcFile "src/main/AndroidManifestDeprecated.xml"
86+
manifest.srcFile "src/main/AndroidManifestNew.xml"
8787
}
8888
}
8989
}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.<%- project.package -%>">
23
</manifest>
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.<%- project.package -%>">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32
</manifest>

0 commit comments

Comments
 (0)