Skip to content

Commit c5cb6c7

Browse files
authored
feat(android): gradle namespace support for AGP versions >7.3 (#399)
Currently the `AndroidManifest.xml` still contains the `package` attribute which will result in a warning for users on 0.73.
1 parent dcbe447 commit c5cb6c7

File tree

1 file changed

+9
-0
lines changed
  • packages/create-react-native-library/templates/native-common/android

1 file changed

+9
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,16 @@ def getExtOrIntegerDefault(name) {
6464
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["<%- project.name -%>_" + name]).toInteger()
6565
}
6666

67+
def isAGPVersionGreaterThan(version) {
68+
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger()
69+
return agpVersion > version
70+
}
71+
6772
android {
73+
if (isAGPVersionGreaterThan(7)) {
74+
namespace "com.<%- project.package -%>"
75+
}
76+
6877
<% if (project.cpp || (project.view && (project.arch === "new" || project.arch === "mixed"))) { -%>
6978
ndkVersion getExtOrDefault("ndkVersion")
7079
<% } -%>

0 commit comments

Comments
 (0)