[bug] ADB Reverse Command Fails on Android Development with Next Js
theDeal opened this issue · 2 comments
Describe the bug
Bug Report: ADB Reverse Command Fails on Android Development
Description
When running the command pnpm tauri android dev
, I encounter an error where the adb reverse
command fails with exit code 1. This prevents the app from being served correctly to the Android emulator.
Expected Behavior
The app should compile successfully, and the adb reverse
command should allow access to the local server running on http://localhost:3000
from the emulator.
Actual Behavior
The following error is displayed in the terminal output:
Error command ["/home/sgeist/Android/Sdk/platform-tools/adb", "reverse", "tcp:3000", "tcp:3000"] exited with code 1
Additional Information
- Tauri Version: 2.0.0-rc.15
- Next.js Version: 14.2.13
- Operating System: [Your OS, e.g., Ubuntu 20.04]
- Android Emulator: Pixel 8a API 35
- Log Output: The
adb logcat
output shows various messages, but no specific errors related toadb reverse
.
Troubleshooting Steps Taken
- Verified that ADB is functioning correctly with
adb devices
. - Attempted to run the
adb reverse tcp:3000 tcp:3000
command manually, which also fails. - Restarted the Android emulator multiple times.
- Ensured that the necessary permissions and configurations for ADB are correctly set.
Possible Solution
- It may be beneficial to implement better error handling for the
adb reverse
command within the Tauri CLI or to provide clearer messages if the command fails, and why.
Reproduction
No response
Expected behavior
When executing the command pnpm tauri android dev
, the following should occur:
-
Successful Compilation: The Tauri and Next.js applications should compile without errors, indicating that the build process has completed successfully.
-
Server Start-Up: A local development server should start at
http://localhost:3000
, allowing access to the application in a web browser or from the Android emulator. -
ADB Reverse Command Success: The command
adb reverse tcp:3000 tcp:3000
should execute successfully, establishing a reverse proxy from the emulator to the local development server. This would enable the Android application to access resources hosted on the local machine. -
App Functionality: Once the above steps are completed successfully, the Android emulator should launch the application, allowing users to interact with it without any connectivity issues. The application should display the UI correctly, reflecting any updates made in the development environment.
-
No Error Messages: There should be no error messages or warnings in the terminal output regarding the ADB connection or reverse command, ensuring that the setup is working as intended.
Full tauri info
output
[✔] Environment
- OS: Fedora 40 X64
✔ webkit2gtk-4.1: 2.44.3
✔ rsvg2: 2.57.1
✔ rustc: 1.78.0 (9b00956e5 2024-04-29)
✔ cargo: 1.78.0 (54d8815d0 2024-03-26)
✔ rustup: 1.26.0
✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
- node: 20.11.1
- pnpm: 9.4.0
- yarn: 1.22.22
- npm: 10.8.1
[-] Packages
- tauri [RUST]: 2.0.0-rc.15
- tauri-build [RUST]: 2.0.0-rc.12
- wry [RUST]: 0.43.1
- tao [RUST]: 0.30.2
- @tauri-apps/api [NPM]: 1.6.0
- @tauri-apps/cli [NPM]: 2.0.0-rc.0
[-] App
- build-type: bundle
- CSP: unset
- frontendDist: ../out
- devUrl: http://localhost:3000/
- framework: React (Next.js)
- bundler: Webpack
Stack trace
No response
Additional context
No response
Here the ERROR output
`pnpm tauri android dev !10303
qr-pong-native-next@0.1.0 tauri /home/sgeist/qr-pong-native-next
tauri "android" "dev"
Info Detected connected device: Medium_Phone_API_35 (sdk_gphone64_x86_64) with target "x86_64-linux-android"
Running BeforeDevCommand (`pnpm dev`)
qr-pong-native-next@0.1.0 dev /home/sgeist/qr-pong-native-next
next dev
▲ Next.js 14.2.3
- Local: http://localhost:3000
- Environments: .env
✓ Starting...
Info detected host target triple "x86_64-unknown-linux-gnu"
Finished dev
profile [unoptimized + debuginfo] target(s) in 0.33s
Info symlinking lib "/home/sgeist/qr-pong-native-next/src-tauri/target/x86_64-linux-android/debug/libapp_lib.so" in jniLibs dir "/home/sgeist/qr-pong-native-next/src-tauri/gen/android/app/src/main/jniLibs/x86_64"
Info "/home/sgeist/qr-pong-native-next/src-tauri/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "libandroid.so"
Info "/home/sgeist/qr-pong-native-next/src-tauri/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "libdl.so"
Info "/home/sgeist/qr-pong-native-next/src-tauri/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "liblog.so"
Info "/home/sgeist/qr-pong-native-next/src-tauri/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "libm.so"
Info "/home/sgeist/qr-pong-native-next/src-tauri/target/x86_64-linux-android/debug/libapp_lib.so" requires shared lib "libc.so"
Error command ["/home/sgeist/Android/Sdk/platform-tools/adb", "reverse", "tcp:3000", "tcp:3000"] exited with code 1
ELIFECYCLE Command failed with exit code 1.
`
Is Fixed on the newest Version: