Skip to content

Commit

Permalink
fix: add namespace for AGP <4.2 support (#152)
Browse files Browse the repository at this point in the history
* fix: add namespace for AGP <4.2 support

* chore: backwards compatibility

* fix: rm package from manifest for gradle 8.0
  • Loading branch information
Looskie authored Jan 25, 2024
1 parent 96aa834 commit 8935005
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
15 changes: 12 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ def safeExtGet(prop, fallback) {
}

android {
// Compatibility for AGP v. <4.2/Gradle 8
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger()
if (agpVersion >= 7) {
namespace 'com.intercom.reactnative'
}

compileSdkVersion safeExtGet('IntercomReactNative_compileSdkVersion', 34)
defaultConfig {
minSdkVersion safeExtGet('IntercomReactNative_minSdkVersion', 21)
Expand All @@ -40,9 +46,12 @@ android {
lintOptions {
disable 'GradleCompatible'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

if (agpVersion < 8) {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
}

Expand Down
3 changes: 1 addition & 2 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.intercom.reactnative">

This comment has been minimized.

Copy link
@filipef101

filipef101 Feb 26, 2024

@Looskie Why was this removed? Getting this because of this change, reverting in a local patch fixes it

error Failed to build the app: No package name found. Found errors in [REDACTED]/node_modules/@intercom/intercom-react-native/android/src/main/AndroidManifest.xml.

This comment has been minimized.

Copy link
@Looskie

Looskie Feb 26, 2024

Author Contributor

You're right, this breaks backwards compatibility. Will submit a PR

Edit:
Created the PR: #164

@filipef101 you think you could apply the diff and let me know if it works, I really only just read the docs and it seems like namepsace in gradle is compatible with lower versions.

<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>

0 comments on commit 8935005

Please sign in to comment.