Skip to content

Commit

Permalink
fix(android): check androidX version at early build process before re…
Browse files Browse the repository at this point in the history
…ally launching build (#4388)
  • Loading branch information
freeboub authored Jan 25, 2025
1 parent 4395503 commit 638f454
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ buildscript {
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['RNVideo_kotlinVersion']
def requiredKotlinVersion = project.properties['RNVideo_kotlinVersion']

def androidx_version = rootProject.ext.has('androidxActivityVersion') ? rootProject.ext.get('androidxActivityVersion') : project.properties['RNVideo_androidxActivityVersion']
def requiredAndroidxVersion = project.properties['RNVideo_androidxActivityVersion']

def isVersionAtLeast = { version, requiredVersion ->
def (v1, v2) = [version, requiredVersion].collect { it.tokenize('.')*.toInteger() }
for (int i = 0; i < Math.max(v1.size(), v2.size()); i++) {
Expand Down Expand Up @@ -35,6 +38,11 @@ buildscript {
} else {
println("Kotlin version is correct: $kotlin_version")
}
if (!isVersionAtLeast(androidx_version, requiredAndroidxVersion)) {
throw new GradleException("AndroidX version mismatch: Project is using Kotlin version $requiredAndroidxVersion, but it must be at least $requiredAndroidxVersion. Please update the Kotlin version.")
} else {
println("AndroidX version is correct: $androidx_version")
}
}
}

Expand Down

0 comments on commit 638f454

Please sign in to comment.