tauri-apps/tauri

Android Build Missing Libraries? (libandroid.so, etc.)

ApprenticeofEnder opened this issue · 0 comments

Describe the bug

In summary, the application does not want to compile to Android specifically. Desktop works fine. I have tried looking for ways to install these missing libraries, but it looks like either I already have the prerequisite packages, or whatever the fix a given forum page proposes is irrelevant to my context somehow.

Reproduction

  1. Create a Tauri project on Linux Mint using pnpm and Svelte for the front end
  2. Install prerequisites (Android Studio, SDK, GTK, etc.)
  3. Run pnpm tauri android init (successfully!)
  4. Run pnpm tauri dev --open --verbose

Expected behavior

A mobile emulator akin to that on Android Studio should pop up with the base Tauri app.

Full tauri info output

[✔] Environment
    - OS: Linux Mint 21.3.0 x86_64 (X64)
    ✔ webkit2gtk-4.1: 2.46.3
    ✔ rsvg2: 2.52.5
    ✔ rustc: 1.83.0 (90b35a623 2024-11-26)
    ✔ cargo: 1.83.0 (5ffbef321 2024-10-29)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 20.11.0
    - pnpm: 9.0.5
    - npm: 10.2.4

[-] Packages
    - tauri 🦀: 2.1.1
    - tauri-build 🦀: 2.0.3
    - wry 🦀: 0.47.2
    - tao 🦀: 0.30.8
    - tauri-cli 🦀: 1.5.12
    - @tauri-apps/api : 2.1.1
    - @tauri-apps/cli : 2.1.0

[-] Plugins

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../build
    - devUrl: http://localhost:1420/
    - framework: Svelte
    - bundler: Vite

Stack trace

Getting an error like this when I run pnpm run tauri dev --open --verbose:

Info [cargo_mobile2::android::jnilibs] symlinking lib "/home/ender/Documents/Projects/ChatLogged/client/src-tauri/target/aarch64-linux-android/debug/libclient_lib.so" in jniLibs dir "/home/ender/Documents/Projects/ChatLogged/client/src-tauri/gen/android/app/src/main/jniLibs/arm64-v8a"
    Info [cargo_mobile2::android::ndk] "/home/ender/Documents/Projects/ChatLogged/client/src-tauri/target/aarch64-linux-android/debug/libclient_lib.so" requires shared lib "libandroid.so"
    Info [cargo_mobile2::android::ndk] "/home/ender/Documents/Projects/ChatLogged/client/src-tauri/target/aarch64-linux-android/debug/libclient_lib.so" requires shared lib "libdl.so"
    Info [cargo_mobile2::android::ndk] "/home/ender/Documents/Projects/ChatLogged/client/src-tauri/target/aarch64-linux-android/debug/libclient_lib.so" requires shared lib "liblog.so"
    Info [cargo_mobile2::android::ndk] "/home/ender/Documents/Projects/ChatLogged/client/src-tauri/target/aarch64-linux-android/debug/libclient_lib.so" requires shared lib "libm.so"
    Info [cargo_mobile2::android::ndk] "/home/ender/Documents/Projects/ChatLogged/client/src-tauri/target/aarch64-linux-android/debug/libclient_lib.so" requires shared lib "libc.so"
    Info [tauri_cli::mobile::android] Opening Android Studio
    Error [tauri_cli::mobile::android] Launch failed: No such file or directory (os error 2)

I'm pretty sure it has something to do with libraries straight up not existing, OR it's Android Studio not wanting to open some file. However, I'm thinking it might be the former due to how the error message is laid out.

Additional context

which pkg-config
/home/linuxbrew/.linuxbrew/bin/pkg-config

java --version
java 17.0.10 2024-01-16 LTS
Java(TM) SE Runtime Environment (build 17.0.10+11-LTS-240)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.10+11-LTS-240, mixed mode, sharing)

/opt/android-studio/bin/studio --version
Android Studio Ladybug | 2024.2.1 Patch 3
Build #AI-242.23339.11.2421.12700392

printenv ANDROID_HOME
/home/ender/Android/Sdk

printenv NDK_HOME
/home/ender/Android/Sdk/ndk/28.0.12674087

In case any of that helps. pkg-config --list-all doesn't seem to list anything with "android" in it, neither does sudo ldconfig -p.

libdl.so.2 exists according to ldconfig? Interestingly? Not sure if that matters. libc.so.6 also shows up in there.