From 752f72dcc22c64e7505de63714710e108dd26278 Mon Sep 17 00:00:00 2001 From: louiszawadzki Date: Wed, 4 Oct 2023 16:58:50 +0200 Subject: [PATCH 1/2] Add support for AGP 8.0 --- packages/core/android/build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/core/android/build.gradle b/packages/core/android/build.gradle index 10b8a18e7..6e1b4e8de 100644 --- a/packages/core/android/build.gradle +++ b/packages/core/android/build.gradle @@ -84,6 +84,10 @@ def getExtOrIntegerDefault(name) { android { compileSdkVersion getExtOrIntegerDefault('compileSdkVersion') buildToolsVersion getExtOrDefault('buildToolsVersion') + buildFeatures { + buildConfig = true + } + namespace = "com.datadog.reactnative" defaultConfig { minSdkVersion 21 targetSdkVersion getExtOrIntegerDefault('targetSdkVersion') From 7ea79da2fdbaaae1d531f90bac6719206f313a20 Mon Sep 17 00:00:00 2001 From: louiszawadzki Date: Tue, 10 Oct 2023 13:29:36 +0200 Subject: [PATCH 2/2] Apply changes conditionally on AGP version --- packages/core/android/build.gradle | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/core/android/build.gradle b/packages/core/android/build.gradle index 6e1b4e8de..43e5b8bcb 100644 --- a/packages/core/android/build.gradle +++ b/packages/core/android/build.gradle @@ -84,10 +84,16 @@ def getExtOrIntegerDefault(name) { android { compileSdkVersion getExtOrIntegerDefault('compileSdkVersion') buildToolsVersion getExtOrDefault('buildToolsVersion') - buildFeatures { + def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION + if (agpVersion.tokenize('.')[0].toInteger() >= 7) { + namespace = "com.datadog.reactnative" + } + if (agpVersion.tokenize('.')[0].toInteger() >= 8) { + buildFeatures { buildConfig = true + } } - namespace = "com.datadog.reactnative" + defaultConfig { minSdkVersion 21 targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')