fix: Reconfigure and add toolchain to wake up Android app
This commit is contained in:
parent
854cc69414
commit
633a6ac032
51
autoqa/scripts/setup-android-env.sh
Executable file
51
autoqa/scripts/setup-android-env.sh
Executable file
@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Android Development Environment Setup for Jan
|
||||
|
||||
# Ensure rustup's Rust toolchain is used instead of Homebrew's
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
|
||||
# Set JAVA_HOME for Android builds
|
||||
export JAVA_HOME=/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home
|
||||
export PATH="/opt/homebrew/opt/openjdk@17/bin:$PATH"
|
||||
|
||||
export ANDROID_HOME=~/Library/Android/sdk
|
||||
export ANDROID_NDK_ROOT=~/Library/Android/sdk/ndk/29.0.14033849
|
||||
export NDK_HOME=~/Library/Android/sdk/ndk/29.0.14033849
|
||||
|
||||
# Add Android tools to PATH
|
||||
export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/emulator:$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin
|
||||
|
||||
# Set up CC and CXX for Android compilation
|
||||
export CC_aarch64_linux_android=$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang
|
||||
export CXX_aarch64_linux_android=$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang++
|
||||
export AR_aarch64_linux_android=$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar
|
||||
export RANLIB_aarch64_linux_android=$NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ranlib
|
||||
|
||||
# Create symlinks for Android tools if they don't exist
|
||||
mkdir -p ~/.local/bin
|
||||
if [ ! -f ~/.local/bin/aarch64-linux-android-ranlib ]; then
|
||||
ln -sf $NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ranlib ~/.local/bin/aarch64-linux-android-ranlib
|
||||
fi
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
|
||||
echo "Android environment configured:"
|
||||
echo "ANDROID_HOME: $ANDROID_HOME"
|
||||
echo "ANDROID_NDK_ROOT: $ANDROID_NDK_ROOT"
|
||||
echo "PATH includes NDK toolchain: $(echo $PATH | grep -o "ndk.*bin" || echo "NOT FOUND")"
|
||||
|
||||
# Verify required tools
|
||||
echo -e "\nChecking required tools:"
|
||||
which adb && echo "✅ adb found" || echo "❌ adb not found"
|
||||
which emulator && echo "✅ emulator found" || echo "❌ emulator not found"
|
||||
which $CC_aarch64_linux_android && echo "✅ Android clang found" || echo "❌ Android clang not found"
|
||||
|
||||
# Show available AVDs
|
||||
echo -e "\nAvailable Android Virtual Devices:"
|
||||
emulator -list-avds 2>/dev/null || echo "No AVDs found"
|
||||
|
||||
# Execute the provided command
|
||||
if [ "$1" ]; then
|
||||
echo -e "\nExecuting: $@"
|
||||
exec "$@"
|
||||
fi
|
||||
10
src-tauri/Cargo.lock
generated
10
src-tauri/Cargo.lock
generated
@ -3079,6 +3079,15 @@ version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e"
|
||||
|
||||
[[package]]
|
||||
name = "openssl-src"
|
||||
version = "300.5.2+3.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d270b79e2926f5150189d475bc7e9d2c69f9c4697b185fa917d5a32b792d21b4"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.9.109"
|
||||
@ -3087,6 +3096,7 @@ checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"openssl-src",
|
||||
"pkg-config",
|
||||
"vcpkg",
|
||||
]
|
||||
|
||||
@ -43,7 +43,7 @@ hyper = { version = "0.14", features = ["server"] }
|
||||
jan-utils = { path = "./utils" }
|
||||
libloading = "0.8.7"
|
||||
log = "0.4"
|
||||
reqwest = { version = "0.11", features = ["json", "blocking", "stream"] }
|
||||
reqwest = { version = "0.11", features = ["json", "blocking", "stream", "native-tls-vendored"] }
|
||||
rmcp = { version = "0.6.0", features = [
|
||||
"client",
|
||||
"transport-sse-client",
|
||||
|
||||
@ -45,7 +45,14 @@ pub fn get_vulkan_gpus(lib_path: &str) -> Vec<GpuInfo> {
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_c_string(buf: &[i8]) -> String {
|
||||
fn parse_c_string_i8(buf: &[i8]) -> String {
|
||||
unsafe { std::ffi::CStr::from_ptr(buf.as_ptr() as *const u8) }
|
||||
.to_str()
|
||||
.unwrap_or_default()
|
||||
.to_string()
|
||||
}
|
||||
|
||||
fn parse_c_string_u8(buf: &[u8]) -> String {
|
||||
unsafe { std::ffi::CStr::from_ptr(buf.as_ptr()) }
|
||||
.to_str()
|
||||
.unwrap_or_default()
|
||||
@ -96,7 +103,7 @@ fn get_vulkan_gpus_internal(lib_path: &str) -> Result<Vec<GpuInfo>, Box<dyn std:
|
||||
}
|
||||
|
||||
let device_info = GpuInfo {
|
||||
name: parse_c_string(&props.device_name),
|
||||
name: parse_c_string_u8(&props.device_name),
|
||||
total_memory: unsafe { instance.get_physical_device_memory_properties(*device) }
|
||||
.memory_heaps
|
||||
.iter()
|
||||
@ -105,7 +112,7 @@ fn get_vulkan_gpus_internal(lib_path: &str) -> Result<Vec<GpuInfo>, Box<dyn std:
|
||||
.sum(),
|
||||
vendor: Vendor::from_vendor_id(props.vendor_id),
|
||||
uuid: parse_uuid(&id_props.device_uuid),
|
||||
driver_version: parse_c_string(&driver_props.driver_info),
|
||||
driver_version: parse_c_string_u8(&driver_props.driver_info),
|
||||
nvidia_info: None,
|
||||
vulkan_info: Some(VulkanInfo {
|
||||
index: i as u64,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user