Skip to content

Commit f569bfe

Browse files
mikehardyBartoszKlonowski
andauthoredDec 1, 2023
fix(android): android gradle plugin 8 compatibility (#553)
* fix(android): android gradle plugin 8 compatibility * Be specific regarding both major and minor version of ANDROID_GRADLE_PLUGIN_VERSION * Replace `parsed` with `agpVersion` * Tokenize `ANDROID_GRADLE_PLUGIN_VERSION` --------- Co-authored-by: Bartosz Klonowski <70535775+BartoszKlonowski@users.noreply.github.com>
1 parent e88480e commit f569bfe

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
 

‎package/android/build.gradle

+12
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ def getExtOrIntegerDefault(name) {
3131
}
3232

3333
android {
34+
35+
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
36+
// Check AGP version for backward compatibility w/react-native versions still on gradle plugin 6
37+
def major = agpVersion[0].toInteger()
38+
def minor = agpVersion[1].toInteger()
39+
if ((major == 7 && minor >= 3) || major >= 8) {
40+
namespace "com.reactnativecommunity.slider"
41+
buildFeatures {
42+
buildConfig true
43+
}
44+
}
45+
3446
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
3547
buildToolsVersion getExtOrDefault('buildToolsVersion')
3648

0 commit comments

Comments
 (0)
Please sign in to comment.