Open12

WSL2 環境で Tauri + Next.js を動かそうとしたけどできなかった

1515
  • Ubuntu 上で Android Studio を動かすのがムズい
  • かといって Windows から Next.js を動かすのもムズい
1515

素直に macOS でやり直している

1515

WSL2 Ubuntu と同じエラーが出てダメ

error[E0432]: unresolved import `linux_raw_sys::ioctl`
   --> /home/{username}/.cargo/registry/src/github.com-1ecc6299db9ec823/rustix-0.37.17/src/backend/libc/io/syscalls.rs:384:24
    |
384 |     use linux_raw_sys::ioctl::EXT4_IOC_RESIZE_FS;
    |                        ^^^^^ could not find `ioctl` in `linux_raw_sys`

   Compiling http v0.2.9
   Compiling combine v4.6.6
   Compiling tokio v1.28.0
   Compiling base64 v0.21.0
   Compiling flate2 v1.0.26
   Compiling regex v1.8.1
   Compiling tar v0.4.38
   Compiling treediff v4.0.2
   Compiling html5ever v0.25.2
For more information about this error, try `rustc --explain E0432`.
error: could not compile `rustix` due to previous error
warning: build failed, waiting for other jobs to finish...
       Error `Failed to run `cargo build`: Command "cargo build --package app --manifest-path /home/obata/workspace/next-tauri/src-tauri/Cargo.toml --target x86_64-linux-android --color always" didn't complete successfully, exiting with code 101.
error Command failed with exit code 1.
1515

cargo update したら治った
rustix が 0.37.18 になったためだと思われる

1515

WSL2 だと代わりにこれが出てダメ

--- adb starting (pid 19939) ---
adb I 04-30 12:55:21 19939 19939 main.cpp:63] Android Debug Bridge version 1.0.41
adb I 04-30 12:55:21 19939 19939 main.cpp:63] Version 34.0.1-9680074
adb I 04-30 12:55:21 19939 19939 main.cpp:63] Installed as /home/obata/Android/Sdk/platform-tools/adb
adb I 04-30 12:55:21 19939 19939 main.cpp:63]
adb F 04-30 12:55:21 19939 19939 main.cpp:165] could not install *smartsocket* listener: Address already in use

* failed to start daemon
adb: cannot connect to daemon
       Error Failed to install APK: Command "/home/obata/Android/Sdk/platform-tools/adb -s emulator-5554 install /home/obata/workspace/next-tauri/src-tauri/gen/android/app/app/build/outputs/apk/x86_64/debug/app-x86_64-debug.apk" didn't complete successfully, exiting with code 1.

error Command failed with exit code 1.
1515

kill {PID} とか adb kill-server してもだめ

1515

WSL2 の方はそもそも WSL2 で Android emulator がうまく動いていない気がする
やたら大きく表示されて、ボタン類が効かない

1515

macOS だと、一回 yarn tauri android build したらできた

1515
  • yarn tauri android build
  • yarn tauri android dev --open

で、Windows も macOS でも動作確認ができた。

ただ WSL2 は -- open をつけても、Android Studio のパスが見えていないらしくダメ。
それっぽく Android Studio をインストールしたパスを通そうとしても無理。

Error Launch failed: Failed to wait for child process for command "Android Studio" to exit: No such file or directory (os error 2)
1515

でも、相変わらず WSL2 から起動したエミュレーターはデカすぎるし、ボタンが効かない。

1515

chown kvm /dev/kvm が必要だったり、ハマったところは無限にあるけれども、もはや何の対応をしたのか覚えていないので、ここには書けない。