chore(android): bump kotlin version (#3334)

* chore(android): update gradle files

* docs: update android installation section
This commit is contained in:
Krzysztof Moch 2023-11-08 07:41:17 +01:00 committed by GitHub
parent 722ae3477a
commit 6df0f7d1c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 13 deletions

View File

@ -1,9 +1,10 @@
import com.android.Version
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
buildscript {
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') :
(project.properties['RNSAC_kotlinVersion'] ? project.properties['RNSAC_kotlinVersion'] : "1.6.10")
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['RNVideo_kotlinVersion']
repositories {
mavenCentral()
@ -14,8 +15,8 @@ buildscript {
}
}
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
def safeExtGet(prop) {
return rootProject.ext.has(prop) ? rootProject.ext.get(prop) : project.properties["RNVideo_" + prop]
}
def getExtOrDefault(name, defaultValue) {
@ -27,7 +28,7 @@ def isNewArchitectureEnabled() {
}
def supportsNamespace() {
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
def parsed = Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
def major = parsed[0].toInteger()
def minor = parsed[1].toInteger()
@ -39,7 +40,7 @@ def supportsNamespace() {
return major >= 8
}
def useExoplayerIMA = safeExtGet("RNVUseExoplayerIMA", false)
def useExoplayerIMA = getExtOrDefault("RNVUseExoplayerIMA", false)
println "useExoplayerIMA:" + useExoplayerIMA
@ -66,10 +67,10 @@ android {
}
}
compileSdkVersion safeExtGet('compileSdkVersion', 31)
buildToolsVersion safeExtGet('buildToolsVersion', '30.0.2')
compileSdkVersion safeExtGet('compileSdkVersion')
buildToolsVersion safeExtGet('buildToolsVersion')
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
def agpVersion = Version.ANDROID_GRADLE_PLUGIN_VERSION
if (agpVersion.tokenize('.')[0].toInteger() < 8) {
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
@ -82,8 +83,8 @@ android {
}
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 21)
targetSdkVersion safeExtGet('targetSdkVersion', 28)
minSdkVersion safeExtGet('minSdkVersion')
targetSdkVersion safeExtGet('targetSdkVersion')
versionCode 1
versionName "1.0"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
@ -144,10 +145,13 @@ repositories {
mavenCentral()
}
def kotlin_version = getExtOrDefault('kotlinVersion', project.properties['RNSAC_kotlinVersion'])
def kotlin_version = safeExtGet('kotlinVersion')
dependencies {
implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
// For < 0.71, this will be from the local maven repo
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+"
implementation('com.google.android.exoplayer:exoplayer:2.18.1') {
exclude group: 'com.android.support'
}

View File

@ -0,0 +1,6 @@
RNVideo_kotlinVersion=1.7.0
RNVideo_minSdkVersion=21
RNVideo_targetSdkVersion=31
RNVideo_compileSdkVersion=31
RNVideo_ndkversion=21.4.7075529
RNVideo_buildToolsVersion=30.0.2

View File

@ -92,6 +92,18 @@ include ':react-native-video'
project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android')
```
`android/build.gradle`
From version >= 6.0.0, your application needs to have kotlin version >= 1.7.0
```:
buildscript {
...
ext.kotlinVersion = '1.7.0'
...
}
```
`android/app/build.gradle`
From version >= 5.0.0, you have to apply these changes: