dart-archive/wasm

First build with flutter_wasm for android is flaky

liamappelbe opened this issue · 1 comments

The first build of a flutter_wasm app for android sometimes fails. Specifically, the app will build successfully, but at runtime it will be missing libwasmer.so.

Rebuilding fixes the issue, and it never happens again, but we should still figure out why it's happening. At the very least, we should add a check to setup.dart to make sure the artifacts are all produced correctly, so that the build doesn't claim to succeed when it has actually failed.

You can see the issue if you watch one of the output directories during the build. Eg, in flutter_wasm/example, repeatedly run ls build/app/intermediates/stripped_native_libs/debug/out/lib/arm64-v8a/ as the app is building. You can see the artifacts appear, but then the whole directory is deleted and remade, and all that's left is libflutter.so. The build succeeds the second time because libflutter.so is not rebuilt. So there's still 2 issues:

  1. Before fixing this bug, get the build to fail if the expected libraries don't exist. Do we need to declare them somewhere?
  2. Fix the bug. Do the libraries need to go somewhere else?