Hi! π
Firstly, thanks for maintaining react-native-tts β really appreciate the work π
Problem
react-native-tts@4.1.1 fails to build on modern React Native / Android
toolchains due to:
- usage of
jcenter() (deprecated and removed)
- outdated Android Gradle Plugin assumptions
- low compileSdk / targetSdk versions
Solution
Updated the Android library configuration to:
- remove legacy
buildscript {} block
- replace
jcenter() with google() + mavenCentral()
- bump compileSdk / targetSdk to 34
- enable Java 8 compatibility
This allows the library to build successfully with current
Android Gradle Plugin and React Native versions.
Below is the patch diff that resolved the issue:
diff --git a/node_modules/react-native-tts/android/build.gradle b/node_modules/react-native-tts/android/build.gradle
index dbbe046..4b568f2 100644
--- a/node_modules/react-native-tts/android/build.gradle
+++ b/node_modules/react-native-tts/android/build.gradle
@@ -2,31 +2,26 @@ def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
-buildscript {
- repositories {
-
- }
- dependencies {
-
classpath 'com.android.tools.build:gradle:1.3.1'
- }
-}
apply plugin: 'com.android.library'
android {
- compileSdkVersion safeExtGet('compileSdkVersion', 26)
- buildToolsVersion safeExtGet('buildToolsVersion', '26.0.3')
-
minSdkVersion safeExtGet('minSdkVersion', 16)
-
targetSdkVersion safeExtGet('targetSdkVersion', 26)
-
minSdkVersion safeExtGet('minSdkVersion', 21)
-
targetSdkVersion safeExtGet('targetSdkVersion', 34)
versionCode 1
versionName "1.0"
}
- compileOptions {
-
sourceCompatibility JavaVersion.VERSION_1_8
-
targetCompatibility JavaVersion.VERSION_1_8
- }
}
repositories {
- google()
mavenCentral()
}
Hi! π
Firstly, thanks for maintaining
react-native-ttsβ really appreciate the work πProblem
react-native-tts@4.1.1fails to build on modern React Native / Androidtoolchains due to:
jcenter()(deprecated and removed)Solution
Updated the Android library configuration to:
buildscript {}blockjcenter()withgoogle()+mavenCentral()This allows the library to build successfully with current
Android Gradle Plugin and React Native versions.
Below is the patch diff that resolved the issue:
diff --git a/node_modules/react-native-tts/android/build.gradle b/node_modules/react-native-tts/android/build.gradle
index dbbe046..4b568f2 100644
--- a/node_modules/react-native-tts/android/build.gradle
+++ b/node_modules/react-native-tts/android/build.gradle
@@ -2,31 +2,26 @@ def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
-buildscript {
-}
apply plugin: 'com.android.library'
android {
compileSdkVersion safeExtGet('compileSdkVersion', 34)
defaultConfig {
}
repositories {
mavenCentral()
}