Skip to content

Commit 8935005

Browse files
authored
fix: add namespace for AGP <4.2 support (#152)
* fix: add namespace for AGP <4.2 support * chore: backwards compatibility * fix: rm package from manifest for gradle 8.0
1 parent 96aa834 commit 8935005

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

android/build.gradle

+12-3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ def safeExtGet(prop, fallback) {
2323
}
2424

2525
android {
26+
// Compatibility for AGP v. <4.2/Gradle 8
27+
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger()
28+
if (agpVersion >= 7) {
29+
namespace 'com.intercom.reactnative'
30+
}
31+
2632
compileSdkVersion safeExtGet('IntercomReactNative_compileSdkVersion', 34)
2733
defaultConfig {
2834
minSdkVersion safeExtGet('IntercomReactNative_minSdkVersion', 21)
@@ -40,9 +46,12 @@ android {
4046
lintOptions {
4147
disable 'GradleCompatible'
4248
}
43-
compileOptions {
44-
sourceCompatibility JavaVersion.VERSION_1_8
45-
targetCompatibility JavaVersion.VERSION_1_8
49+
50+
if (agpVersion < 8) {
51+
compileOptions {
52+
sourceCompatibility JavaVersion.VERSION_1_8
53+
targetCompatibility JavaVersion.VERSION_1_8
54+
}
4655
}
4756
}
4857

android/src/main/AndroidManifest.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.intercom.reactnative">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32

43
</manifest>

0 commit comments

Comments
 (0)