Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova application: does webassembly supported on Android?

I am developing an app with Cordova + Webassembly.

The customer needs the app to work on Windows and Android. I am using Visual Studio 2017 + TACO.

The webassembly is generated from C/C++ code using emscripten and is working all fine on Edge and Chrome. It is also working on an Android device (Chrome)

The Cordova app running on Windows is working perfectly.

Now my problem is on Android. The Cordova app on Android log this error:

Fetch API cannot load file:///android_asset/www/script/myApp.wasm. URL scheme "file" is not supported.

I can't find anywhere if Cordova supports WebAssembly on Android. My understanding is Android is using a WebView component and should rely on Google Chrome (my Webassembly is working fine on Chrome on Android). Is there an option somewhere to add a mime-type for cordova on android?

Thanks in advance for any help.

like image 499
Sébastien Mahé Avatar asked Oct 26 '25 09:10

Sébastien Mahé


2 Answers

There is another option using the XMLHttpRequest object like showed at https://studiolacosanostra.github.io/2020/02/23/How-to-run-rust-wasm-on-cordova/.

Of course, you don't need to overwriting the fetch function like they do there, but you certainly can use the idea to create your own function.

like image 70
Paulo Alexandre Avatar answered Oct 28 '25 22:10

Paulo Alexandre


As you can see in the console, "URL scheme must be “http” or “https” for CORS request.".

like image 39
Federico Massi Avatar answered Oct 29 '25 00:10

Federico Massi