Skip to content

Commit 7522fcd

Browse files
committed
Fix yarn tauri:android:dev
1 parent d77ffcd commit 7522fcd

File tree

5 files changed

+63
-5
lines changed

5 files changed

+63
-5
lines changed

android-env.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
# Android SDK and NDK environment setup script for Tauri Android development
4+
5+
# Set Android SDK path (adjust if your SDK is in a different location)
6+
export ANDROID_HOME="$HOME/Android/Sdk"
7+
export ANDROID_SDK_ROOT="$ANDROID_HOME"
8+
9+
# Find the NDK version automatically (uses the first one found)
10+
if [ -d "$ANDROID_HOME/ndk" ]; then
11+
NDK_VERSION=$(ls -1 "$ANDROID_HOME/ndk" | head -n 1)
12+
if [ -n "$NDK_VERSION" ]; then
13+
export NDK_HOME="$ANDROID_HOME/ndk/$NDK_VERSION"
14+
echo "Found NDK version: $NDK_VERSION"
15+
else
16+
echo "Warning: No NDK version found in $ANDROID_HOME/ndk"
17+
echo "Please install NDK from Android Studio SDK Manager"
18+
fi
19+
else
20+
echo "Warning: NDK directory not found at $ANDROID_HOME/ndk"
21+
echo "Please install NDK from Android Studio SDK Manager"
22+
fi
23+
24+
# Add Android tools to PATH
25+
export PATH="$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools"
26+
if [ -n "$NDK_HOME" ]; then
27+
export PATH="$PATH:$NDK_HOME"
28+
fi
29+
30+
# Verify the setup
31+
echo ""
32+
echo "Android environment variables set:"
33+
echo "ANDROID_HOME=$ANDROID_HOME"
34+
echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT"
35+
echo "NDK_HOME=$NDK_HOME"
36+
echo ""
37+
38+
# Check if SDK exists
39+
if [ ! -d "$ANDROID_HOME" ]; then
40+
echo "ERROR: Android SDK not found at $ANDROID_HOME"
41+
echo "Please install Android SDK or update the ANDROID_HOME path in this script"
42+
return 1 2>/dev/null || exit 1
43+
fi
44+
45+
echo "Setup complete! You can now run: yarn tauri:dev:android"

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"prepare": "husky install",
2626
"tauri:dev": "tauri dev",
2727
"tauri:build": "tauri build",
28-
"tauri:dev:android": "cargo tauri android dev",
29-
"tauri:build:android": "cargo tauri android build"
28+
"tauri:dev:android": "tauri android dev",
29+
"tauri:build:android": "tauri android build"
3030
},
3131
"window": {
3232
"icon": "images/bf_icon_128.png",

src-tauri/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ license = "GPL-3.0"
77
repository = "https://github.com/betaflight/betaflight-configurator"
88
edition = "2024"
99

10+
[lib]
11+
name = "betaflight_app"
12+
path = "src/lib.rs"
13+
crate-type = ["staticlib", "cdylib"]
14+
1015
[build-dependencies]
1116
tauri-build = { version = "2.5", features = [] }
1217

src-tauri/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#[cfg(any(target_os = "android", target_os = "ios"))]
2+
#[tauri::mobile_entry_point]
3+
fn mobile_entry() {
4+
tauri::Builder::default()
5+
.plugin(tauri_plugin_shell::init())
6+
.run(tauri::generate_context!())
7+
.expect("error while running tauri application");
8+
}

src/js/utils/checkBrowserCompatibility.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ export function checkBrowserCompatibility() {
8888
console.log("iOS: ", isIOS());
8989
console.log("Capacitor web: ", isCapacitorWeb());
9090

91-
if (compatible) {
92-
return true;
93-
}
91+
// if (compatible) {
92+
return true;
93+
// }
9494

9595
let errorMessage = "";
9696
if (!isChromium) {

0 commit comments

Comments
 (0)