Skip to content

Commit

Permalink
fix(android): handle namespace properly starting AGP 8 (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
taboulot committed Apr 29, 2024
1 parent 6650c29 commit 8d32e31
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,17 @@ def getExtOrIntegerDefault(name) {

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

defaultConfig {
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.reactnativeimageresizer">

</manifest>

0 comments on commit 8d32e31

Please sign in to comment.