|
| 1 | +--- |
| 2 | +title: "Troubleshoot PWA Wrapper" |
| 3 | +url: /refguide/mobile/pwa-wrapper/pwa-wrapper-troubleshooting/ |
| 4 | +weight: 60 |
| 5 | +description: "Known issues and solutions for PWA Wrapper." |
| 6 | +--- |
| 7 | + |
| 8 | +## Introduction |
| 9 | + |
| 10 | +This page describes known issues you may encounter when building or testing PWA Wrapper apps, along with the steps to resolve them. |
| 11 | + |
| 12 | +## Android |
| 13 | + |
| 14 | +### App Cannot Connect to localhost on a Physical Device{#android-localhost} |
| 15 | + |
| 16 | +**Symptom**: When you set the runtime URL to a localhost address (for example, `http://localhost:8080`) and install the app on a physical Android device, the app fails to load and shows the following error: |
| 17 | + |
| 18 | +``` |
| 19 | +Page Load Error |
| 20 | +net::ERR_CACHE_MISS |
| 21 | +``` |
| 22 | + |
| 23 | +{{< figure src="/attachments/refguide/mobile/pwa-wrapper/localhost-cache-miss-error.png" alt="Page Load Error showing net::ERR_CACHE_MISS on Android" max-width="400px" >}} |
| 24 | + |
| 25 | +**Cause**: Two things are required for a physical Android device to reach a localhost server on your machine: |
| 26 | + |
| 27 | +1. The app must have the `INTERNET` permission. Without it, the Android OS blocks all outbound network traffic. |
| 28 | +2. The device must have a port forwarding rule from its own localhost to your machine's localhost. Android devices do not forward ports automatically. |
| 29 | + |
| 30 | +**Solution**: |
| 31 | + |
| 32 | +1. In the PWA Wrapper builder, go to the **Permissions** step and enable the **INTERNET** permission. |
| 33 | + |
| 34 | + For general guidance on permissions, see [Build PWA Wrapper Apps](/refguide/mobile/pwa-wrapper/build-pwa-wrapper-apps/). |
| 35 | + |
| 36 | +1. Connect the Android device to your machine via USB and make sure [USB debugging](https://developer.android.com/studio/debug/dev-options) is enabled on the device. |
| 37 | + |
| 38 | +1. Run the following ADB command to forward port 8080 from the device to your machine: |
| 39 | + |
| 40 | + ```shell |
| 41 | + adb reverse tcp:8080 tcp:8080 |
| 42 | + ``` |
| 43 | + |
| 44 | + If your Mendix runtime uses a different port, replace `8080` with the correct port number on both sides. |
| 45 | + |
| 46 | +1. Rebuild and reinstall the app with the localhost runtime URL. |
| 47 | + |
| 48 | +The app can now reach the Mendix runtime running on your development machine. |
| 49 | + |
| 50 | +{{% alert color="info" %}} |
| 51 | +The `adb reverse` rule applies only to the current USB session. You must re-run the command each time you reconnect the device or restart ADB. |
| 52 | +{{% /alert %}} |
0 commit comments