Skip to content

Commit 8d32e31

Browse files
authored
fix(android): handle namespace properly starting AGP 8 (#401)
1 parent 6650c29 commit 8d32e31

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

android/build.gradle

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,17 @@ def getExtOrIntegerDefault(name) {
3333

3434
android {
3535
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
36-
namespace "com.reactnativeimageresizer"
36+
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
37+
def agpMajorVersion = agpVersion.tokenize('.')[0].toInteger()
38+
def agpMinorVersion = agpVersion.tokenize('.')[1].toInteger()
39+
/**
40+
* Namespace should be declared here starting from AGP 8.x, Starting AGP 7.3 it is also supported.
41+
* For AGP < 7.3, namespace should be declared in AndroidManifest.
42+
* See: https://developer.android.com/build/releases/past-releases/agp-8-0-0-release-notes#namespace-dsl
43+
*/
44+
if (agpMajorVersion >= 7 && agpMinorVersion >= 3) {
45+
namespace "com.reactnativeimageresizer"
46+
}
3747

3848
defaultConfig {
3949
minSdkVersion getExtOrIntegerDefault("minSdkVersion")

android/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.reactnativeimageresizer">
22

33
</manifest>

0 commit comments

Comments
 (0)