diff --git a/.gitignore b/.gitignore
index ad0a611..9334586 100644
--- a/.gitignore
+++ b/.gitignore
@@ -77,3 +77,4 @@ yarn-error.log
# Local SDK workspace
sdk/
+sdk-repair/
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 973556d..41a1b61 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -2,6 +2,8 @@ apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"
+apply from: rootProject.file("node.gradle")
+
/**
* This is the configuration block to customize your React Native Android app.
* By default you don't need to apply any configuration, just uncomment the lines you need.
@@ -26,6 +28,7 @@ react {
/* Bundling */
// A list containing the node command and its flags. Default is just 'node'.
// nodeExecutableAndArgs = ["node"]
+ nodeExecutableAndArgs = [resolveNodeExecutable()]
//
// The command to run when bundling. By default is 'bundle'
// bundleCommand = "ram-bundle"
diff --git a/android/node.gradle b/android/node.gradle
new file mode 100644
index 0000000..8a94923
--- /dev/null
+++ b/android/node.gradle
@@ -0,0 +1,48 @@
+def parseNodeVersion = { String value ->
+ value.replaceFirst("^v", "")
+ .tokenize(".")
+ .collect { part ->
+ def matcher = part =~ /\d+/
+ matcher.find() ? matcher.group().toInteger() : 0
+ }
+}
+
+ext.resolveNodeExecutable = {
+ def fromEnv = System.getenv("NODE_BINARY")
+ if (fromEnv != null && !fromEnv.trim().isEmpty()) {
+ return fromEnv.trim()
+ }
+
+ def home = System.getProperty("user.home")
+ def candidates = []
+ def nvmVersionsDir = new File(home, ".nvm/versions/node")
+
+ if (nvmVersionsDir.isDirectory()) {
+ def versionDirs = nvmVersionsDir.listFiles()?.findAll {
+ new File(it, "bin/node").canExecute()
+ } ?: []
+
+ versionDirs.sort { a, b ->
+ def aVersion = parseNodeVersion(a.name)
+ def bVersion = parseNodeVersion(b.name)
+ for (int i = 0; i < Math.max(aVersion.size(), bVersion.size()); i++) {
+ def aPart = i < aVersion.size() ? aVersion[i] : 0
+ def bPart = i < bVersion.size() ? bVersion[i] : 0
+ if (aPart != bPart) {
+ return bPart <=> aPart
+ }
+ }
+ return b.name <=> a.name
+ }.each {
+ candidates.add(new File(it, "bin/node").absolutePath)
+ }
+ }
+
+ candidates.addAll([
+ "${home}/.nvm/current/bin/node",
+ "/opt/homebrew/bin/node",
+ "/usr/local/bin/node"
+ ])
+
+ return candidates.find { new File(it).canExecute() } ?: "node"
+}
diff --git a/android/settings.gradle b/android/settings.gradle
index 23d963a..fc05df9 100644
--- a/android/settings.gradle
+++ b/android/settings.gradle
@@ -1,6 +1,12 @@
pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
plugins { id("com.facebook.react.settings") }
-extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
+apply from: new File(settingsDir, "node.gradle")
+
+def nodeExecutable = resolveNodeExecutable()
+def reactNativeCli = new File(settingsDir, "../node_modules/@react-native-community/cli/build/bin.js")
+extensions.configure(com.facebook.react.ReactSettingsExtension) { ex ->
+ ex.autolinkLibrariesFromCommand([nodeExecutable, reactNativeCli.absolutePath, "config"])
+}
rootProject.name = 'dfuapp'
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')
diff --git a/package.json b/package.json
index 8e77eb5..2db0528 100644
--- a/package.json
+++ b/package.json
@@ -4,12 +4,12 @@
"private": true,
"scripts": {
"android": "react-native run-android",
- "clean-a": "cd android && gradlew clean",
+ "clean-a": "cd android && ./gradlew clean",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest",
- "build-a": "set NODE_OPTIONS=--openssl-legacy-provider && cd android&&gradlew assembleRelease"
+ "build-a": "cd android && ./gradlew assembleRelease"
},
"dependencies": {
"@react-native-async-storage/async-storage": "^2.2.0",
diff --git a/src/HomeScreen.tsx b/src/HomeScreen.tsx
index 16c2ee1..9f7455c 100644
--- a/src/HomeScreen.tsx
+++ b/src/HomeScreen.tsx
@@ -95,9 +95,9 @@ export default function HomeScreen({ navigation }: Props) {
navigation.navigate("ScanScreen2")}>
{t("home.paddle")}
- {/* navigation.navigate("ScanScreen3")}>
+ navigation.navigate("ScanScreen3")}>
{t("home.T5trainer")}
- */}
+