Friday 20 August 2021

Webview cannot load files from static server on Android in release build

I am building a React Native app and having an issue with a webview. This webview has the HTML hardcoded into it, but fetches additional files from a static server running in the app.

This works fine on iOS and it works on Android in development, but when I build an APK the files fail to be loaded into the webview.

I've made a repo where the bug is reproduced. Running this app with npm run android works as intended, and the HTML loads the image from the static server:

enter image description here

But when an APK is build (npm run build) and installed on the device, the image fails to load:

enter image description here

Why is the image not loading in the release build? I know that the static server is working because I can access it from the web browser while the app is running. I've read through the react-native-webview docs and haven't found anything that explains this



from Webview cannot load files from static server on Android in release build

No comments:

Post a Comment