Open mikehardy opened 2 years ago
hey what about that?
This PR has been updated to include the changes required for android gradle plugin 8 compatibility, which will be required with react-native 0.73+
It is working fine for me in a local test app and is similar to what I've done to repositories I maintain like react-native-firebase, react-native-device-info, react-native-netinfo etc
Here's a patch-package file in case it is useful for anyone - note this patch-package is not compatible with android gradle plugin <= 6 since it is just for my personal use, though the PR I proposed is just in case
diff --git a/node_modules/react-native-sqlite-storage/platforms/android-native/build.gradle b/node_modules/react-native-sqlite-storage/platforms/android-native/build.gradle
index 94a8675..0876f13 100644
--- a/node_modules/react-native-sqlite-storage/platforms/android-native/build.gradle
+++ b/node_modules/react-native-sqlite-storage/platforms/android-native/build.gradle
@@ -1,11 +1,17 @@
buildscript {
- repositories {
- google()
- jcenter()
- }
+ // The Android Gradle plugin is only required when opening the android folder stand-alone.
+ // This avoids unnecessary downloads and potential conflicts when the library is included as a
+ // module dependency in an application project.
+ if (project == rootProject) {
+ repositories {
+ mavenCentral()
+ google()
+ }
+ def buildGradleVersion = ext.has('buildGradlePluginVersion') ? ext.get('buildGradlePluginVersion') : '7.0.3'
- dependencies {
- classpath 'com.android.tools.build:gradle:3.1.4'
+ dependencies {
+ classpath "com.android.tools.build:gradle:$buildGradleVersion"
+ }
}
}
@@ -16,12 +22,13 @@ def safeExtGet(prop, fallback) {
}
android {
- compileSdkVersion safeExtGet('compileSdkVersion', 23)
- buildToolsVersion safeExtGet('buildToolsVersion', '27.0.3')
+ namespace "io.liteglue"
+
+ compileSdkVersion safeExtGet('compileSdkVersion', 30)
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
- targetSdkVersion safeExtGet('targetSdkVersion', 22)
+ targetSdkVersion safeExtGet('targetSdkVersion', 28)
versionCode 1
versionName "1.0"
}
diff --git a/node_modules/react-native-sqlite-storage/platforms/android/build.gradle b/node_modules/react-native-sqlite-storage/platforms/android/build.gradle
index ff79b10..ae31851 100644
--- a/node_modules/react-native-sqlite-storage/platforms/android/build.gradle
+++ b/node_modules/react-native-sqlite-storage/platforms/android/build.gradle
@@ -1,11 +1,17 @@
buildscript {
- repositories {
- google()
- jcenter()
- }
+ // The Android Gradle plugin is only required when opening the android folder stand-alone.
+ // This avoids unnecessary downloads and potential conflicts when the library is included as a
+ // module dependency in an application project.
+ if (project == rootProject) {
+ repositories {
+ mavenCentral()
+ google()
+ }
+ def buildGradleVersion = ext.has('buildGradlePluginVersion') ? ext.get('buildGradlePluginVersion') : '7.0.3'
- dependencies {
- classpath 'com.android.tools.build:gradle:3.1.4'
+ dependencies {
+ classpath "com.android.tools.build:gradle:$buildGradleVersion"
+ }
}
}
@@ -16,12 +22,13 @@ def safeExtGet(prop, fallback) {
}
android {
- compileSdkVersion safeExtGet('compileSdkVersion', 23)
- buildToolsVersion safeExtGet('buildToolsVersion', '27.0.3')
+ namespace "org.pgsqlite"
+
+ compileSdkVersion safeExtGet('compileSdkVersion', 30)
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
- targetSdkVersion safeExtGet('targetSdkVersion', 22)
+ targetSdkVersion safeExtGet('targetSdkVersion', 28)
versionCode 1
versionName "1.0"
}
diff --git a/node_modules/react-native-sqlite-storage/react-native.config.js b/node_modules/react-native-sqlite-storage/react-native.config.js
index dc150a9..7dcf0ef 100644
--- a/node_modules/react-native-sqlite-storage/react-native.config.js
+++ b/node_modules/react-native-sqlite-storage/react-native.config.js
@@ -1,9 +1,7 @@
module.exports = {
dependency: {
platforms: {
- ios: {
- project: './platforms/ios/SQLite.xcodeproj'
- },
+ ios: {},
android: {
sourceDir: './platforms/android'
},
Fixes #504
There should be 2 commits here, one for each build.gradle file, but they are the same change in both. Works locally
Second commit coming in a moment when I edit it on my branch