Skip to content

Troubleshooting

Fixes for the problems you're most likely to hit while running and building your app, from unreachable dev servers to failed Android builds.

Introduction

Mobile toolchains have a lot of moving parts, so things occasionally go wrong. Before anything else, run doctor, which checks your project and toolchains and prints the fix for each problem it finds:

laravel-mobile doctor

Every error laravel-mobile prints also includes a code, such as tauri::not_installed, and a suggested fix. This page covers the problems doctor can’t see for you.

Your Phone Can’t Reach the Dev Server

The dev command serves your app on your computer’s network address, so a phone that isn’t connected by cable must be on the same network. If the QR code opens a page that never loads, check the following:

  • Your phone and computer are on the same Wi-Fi network, not a guest network.
  • The network doesn’t use client isolation, which stops devices on the same Wi-Fi from talking to each other. Many office, hotel, and guest networks enable it. A phone hotspot, or a home network, usually works.
  • Your computer’s firewall allows incoming connections on your server’s port (8000 by default), Vite’s port (5173 by default), and, when dev runs Reverb, the Reverb server’s port. The dev banner lists the ports in use, and when pages time out on a phone, it names the ones to allow.

If dev picked the wrong network address, such as a VPN’s, you may provide the address your phone should use:

laravel-mobile dev --host 192.168.1.20

If your Wi-Fi uses client isolation, which is common on ISP routers, connect your Android phone with a USB cable instead. dev android forwards the ports over USB with adb reverse, so the phone doesn’t need the network at all.

For an iPhone, or an Android phone you can’t connect by cable, turn on USB tethering on your phone, find the address your computer received on the tethered connection, and pass it to dev:

laravel-mobile dev --host 192.168.229.170

You’ll still need to allow the ports that the dev banner lists through your firewall.

Server Changes Don’t Appear

When you change your Laravel Rust server’s code, dev restarts the server, but the page that’s already open on your phone keeps its old content. Pull down to refresh, or relaunch the app. Changes to your Inertia pages don’t need this, since Vite updates them on its own.

A Port Is Already in Use

If dev reports that port 8000 is already in use, another server is probably running, such as laravel dev. Stop it, or choose another port:

laravel-mobile dev --port 8080

Every Page Returns a 500 Error

If your .env file’s APP_KEY is empty, every page fails. The dev command warns you about this when it starts. Generate a key from your project’s root:

cargo run -- key:generate

The Tauri CLI Isn’t Installed

The tauri::not_installed error means the Tauri CLI that init added to your package.json file hasn’t been installed yet, which usually happens on a fresh clone. Install your project’s dependencies:

npm install

If your project doesn’t list @tauri-apps/cli at all, for example because you ran init with laravel-mobile-cli 0.1.0, add it yourself:

npm install --save-dev @tauri-apps/cli@^2

Android Builds Fail With “Unresolved Reference ‘TauriActivity’”

The Laravel Rust skeleton can share one Cargo build directory between every app on your machine. When two apps share it, Cargo may skip a step Tauri relies on, and the second app’s Android build fails with Unresolved reference 'TauriActivity'.

laravel-mobile avoids this by giving each app its own build directory, target/mobile-build, whenever it runs Tauri. However, if you set CARGO_BUILD_BUILD_DIR yourself, your value wins. If you see this error, make sure the variable isn’t set in your shell, or point it at a directory inside your project:

export CARGO_BUILD_BUILD_DIR="$PWD/target/mobile-build"

Live Camera Isn’t Available in Dev

If navigator.mediaDevices.getUserMedia fails with a NotAllowedError or reports that it’s undefined in dev, your page isn’t running in a secure context. dev loads your pages over plain http:// on your network address, which browsers don’t treat as secure, so live camera and microphone streams are unavailable.

On an Android phone connected over USB, dev android loads the app from 127.0.0.1, which is a secure context, so the stream works there. On an iPhone, build a release with laravel-mobile build, which loads your app from its https:// server URL. A file input with capture works in dev too.

The Camera Opens the Photo Picker

On Android 11 and later, a file input with capture opens the photo picker unless the app declares the camera intents. Make sure mobile.toml has a camera entry in its permissions section, then run laravel-mobile sync, which laravel-mobile-cli 0.1.1 uses to declare them.

Pages Can’t Call Your Commands

If mobile.invoke fails because Tauri refuses the command, the command isn’t in your app’s permissions. Check that it’s in a tauri::generate_handler![...] call under apps/mobile/src, then run laravel-mobile sync. The command then appears in permissions/app-commands.toml, and you can rebuild the app.

Reverb Doesn’t Start in Dev

When your .env file broadcasts through Reverb, dev starts a local Reverb server for you, but only under these conditions:

  • BROADCAST_CONNECTION is exactly reverb.
  • REVERB_HOST is unset, empty, localhost, 127.0.0.1, or 0.0.0.0. Any other host is treated as a remote server, such as Laravel Cloud’s managed Reverb, and dev leaves Reverb alone.

dev reads each variable from your shell environment first, then from .env. Two ports are involved, and each defaults to 8080 when it’s unset or empty:

  • REVERB_SERVER_PORT is the port the Reverb server listens on. dev starts it with reverb:start on that port. If your package.json file has a dev:reverb script, dev runs that script instead, and the script decides the host and port.
  • REVERB_PORT is the port your pages connect to through Echo. The banner shows it as Reverb ws://<host>:<REVERB_PORT>. When you run dev android over USB, dev forwards this port to REVERB_SERVER_PORT on your phone, so the two may differ.

If a port isn’t a number from 0 to 65535, dev stops with dev::invalid_port. When dev starts Reverb and REVERB_SERVER_PORT is already in use, it stops with dev::port_in_use, so change one of the ports in .env. For example, a SERVER_PORT of 8080 collides with Reverb’s default.

If your .env file uses Reverb but your app’s Cargo features don’t include reverb, dev prints a warning that names the server port, and it neither starts nor forwards Reverb. Add "reverb" to the laravel-rust features in your Cargo.toml file to fix it. The warning also appears with --dry-run.

With --no-server, you run Reverb yourself, so dev doesn’t start it. It still forwards REVERB_PORT over USB.

Dev Android Loops on a Device Prompt

In laravel-mobile-cli 0.1.1, when two or more Android devices are connected and you run dev android without --device, Tauri asks which device to use. dev can’t answer that prompt, so it repeats the prompt over and over. Within minutes it can write gigabytes of log to your disk, and Ctrl+C doesn’t stop it.

Until 0.1.2 ships, avoid the loop by naming the device, which you can find with adb devices:

laravel-mobile dev android --device ZY22J64W7V

Or disconnect the extra device. The fix is planned for 0.1.2, where dev stops at once and lists the connected devices with a --device hint.

A Build Fails Because dev Is Still Running

build ios and build android won’t start while dev runs the app on that platform, since Tauri holds the build until dev stops. The error says dev is running, and the fix is to stop it with Ctrl+C in its terminal, then build again.

If you closed the terminal, or killed dev with kill -9, dev couldn’t clean up its server, Vite and app processes. build then reports build::dev_orphaned and names the command that stops them, kill -- <group>. You may run that command, or run laravel-mobile dev for the same platform again. The new dev stops those leftover processes first, prints a line saying it did, then starts normally.

The Mobile Build Folder Is Too Large

The doctor command warns when target/mobile-build is larger than 10 GB. Tauri builds each app in its own build folder, separate from the shared Cargo build folder that your Laravel Rust server uses, so mobile builds take up space of their own. To empty it, run the fix that doctor shows, or let doctor --fix run it:

rm -rf target/mobile-build

The next mobile build recompiles from scratch, which takes a few minutes.

The Android Emulator Isn’t Found

If you’ve set XDG_CONFIG_HOME, avdmanager creates your emulators under $XDG_CONFIG_HOME/.android/avd, but the emulator and Tauri look somewhere else. If dev android can’t find an emulator you know exists, add the following line to your shell profile:

export ANDROID_AVD_HOME="$XDG_CONFIG_HOME/.android/avd"

The doctor command spots this for you:

▲ Emulators  1 emulator in /home/taylor/.config/.android/avd, where the emulator does not look
    add `export ANDROID_AVD_HOME=/home/taylor/.config/.android/avd` to your shell profile; avdmanager put them there because XDG_CONFIG_HOME is set

A Build Stops for a Missing Variable

If sync, dev android, or build android stops with env::missing, a value in [android.meta_data] uses a variable that isn’t set. The error names the variable, such as GOOGLE_MAPS_KEY. Add it to your .env file, such as GOOGLE_MAPS_KEY=, or set it in the environment. A variable name with a space or another invalid character, such as ${GOOGLE MAPS}, fails validation before anything is written.

If the iOS build fails with undefined symbols whose names start with _init_plugin_, your Rust toolchain is missing the llvm-tools component. Xcode 27 hides the entry points of your app’s Swift plugins from Rust, and the build restores them with llvm-objcopy from llvm-tools. The doctor command reports this as a missing check, and you may add the component with this command:

rustup component add llvm-tools

iOS Builds Fail on Linux or Windows

The native::needs_macos error means you tried to run or build the iOS app on a machine without macOS. Apple only ships Xcode for macOS, so native iOS work needs a Mac. You can still preview your pages on an iPhone’s browser with laravel-mobile dev. The running your app documentation explains what works without a Mac.

Android Release Builds Need an Upload Key

The build::no_upload_key error means build android --release couldn’t find your upload key. The building your app documentation explains how to create one and where it goes.

Type to search…

↑↓ navigate↵ selectEsc close