chore(android): bump kotlin version (#3334)
* chore(android): update gradle files * docs: update android installation section
This commit is contained in:
parent
722ae3477a
commit
6df0f7d1c0
@ -1,9 +1,10 @@
|
|||||||
|
import com.android.Version
|
||||||
|
|
||||||
apply plugin: 'com.android.library'
|
apply plugin: 'com.android.library'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') :
|
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['RNVideo_kotlinVersion']
|
||||||
(project.properties['RNSAC_kotlinVersion'] ? project.properties['RNSAC_kotlinVersion'] : "1.6.10")
|
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@ -14,8 +15,8 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def safeExtGet(prop, fallback) {
|
def safeExtGet(prop) {
|
||||||
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
return rootProject.ext.has(prop) ? rootProject.ext.get(prop) : project.properties["RNVideo_" + prop]
|
||||||
}
|
}
|
||||||
|
|
||||||
def getExtOrDefault(name, defaultValue) {
|
def getExtOrDefault(name, defaultValue) {
|
||||||
@ -27,7 +28,7 @@ def isNewArchitectureEnabled() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def supportsNamespace() {
|
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 major = parsed[0].toInteger()
|
||||||
def minor = parsed[1].toInteger()
|
def minor = parsed[1].toInteger()
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ def supportsNamespace() {
|
|||||||
return major >= 8
|
return major >= 8
|
||||||
}
|
}
|
||||||
|
|
||||||
def useExoplayerIMA = safeExtGet("RNVUseExoplayerIMA", false)
|
def useExoplayerIMA = getExtOrDefault("RNVUseExoplayerIMA", false)
|
||||||
|
|
||||||
println "useExoplayerIMA:" + useExoplayerIMA
|
println "useExoplayerIMA:" + useExoplayerIMA
|
||||||
|
|
||||||
@ -66,10 +67,10 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compileSdkVersion safeExtGet('compileSdkVersion', 31)
|
compileSdkVersion safeExtGet('compileSdkVersion')
|
||||||
buildToolsVersion safeExtGet('buildToolsVersion', '30.0.2')
|
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) {
|
if (agpVersion.tokenize('.')[0].toInteger() < 8) {
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_11
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
@ -82,8 +83,8 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion safeExtGet('minSdkVersion', 21)
|
minSdkVersion safeExtGet('minSdkVersion')
|
||||||
targetSdkVersion safeExtGet('targetSdkVersion', 28)
|
targetSdkVersion safeExtGet('targetSdkVersion')
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
||||||
@ -144,10 +145,13 @@ repositories {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
def kotlin_version = getExtOrDefault('kotlinVersion', project.properties['RNSAC_kotlinVersion'])
|
def kotlin_version = safeExtGet('kotlinVersion')
|
||||||
|
|
||||||
dependencies {
|
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') {
|
implementation('com.google.android.exoplayer:exoplayer:2.18.1') {
|
||||||
exclude group: 'com.android.support'
|
exclude group: 'com.android.support'
|
||||||
}
|
}
|
||||||
|
6
android/gradle.properties
Normal file
6
android/gradle.properties
Normal 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
|
@ -92,6 +92,18 @@ include ':react-native-video'
|
|||||||
project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android')
|
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`
|
`android/app/build.gradle`
|
||||||
|
|
||||||
From version >= 5.0.0, you have to apply these changes:
|
From version >= 5.0.0, you have to apply these changes:
|
||||||
|
Loading…
Reference in New Issue
Block a user