Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example app crashes when building using flutter build apk on 64 bit devices. #45

Closed
yoavrofe opened this issue Mar 24, 2019 · 4 comments
Labels
android bug Something isn't working crash

Comments

@yoavrofe
Copy link
Collaborator

Running flutter build apk and then flutter install builds the apk and installs it on the device. However, running the app results in a crash on 64bit devices.

This happens because the Flutter builder doesn't include libflutter.so for all ABIs. Inspecting the apk file can be done by dragging the apk onto Android Studio. As can be seen in the picture, only the armeabi-v7a directory has both libmapbox-gl.so and libflutter.so.

Screen Shot 2019-03-24 at 12 02 24

A temporary workaround can be done by adding the following to the app/build.gradle

defaultConfig {
...
ndk { abiFilters 'armeabi-v7a' }
}

This builds only the 32bit ARM abi. However, this is not the right way to do it, and Google stated it'll force 64bit support for APKs on the Play Store starting from this summer. This also causes crash on my device when debugging the app.

@yoavrofe yoavrofe added bug Something isn't working android crash labels Mar 24, 2019
@tobrun
Copy link
Collaborator

tobrun commented Mar 27, 2019

interesting find @yoavrofe, not much we can do on our end. Maybe we should create an issue upstream?

@yoavrofe
Copy link
Collaborator Author

I'll be glad if you could create the issue, as I think you are more experienced with Android ABI.

@m0nac0
Copy link
Collaborator

m0nac0 commented Jan 11, 2020

@tobrun did you ever open an issue upstream for this? I just tested this and if I build a fat apk (with flutter build apk) I still see a similiar behaviour. libmapbox-gl.so is included for all ABIs, but libflutter.so is only included for arm64-v8a. I can't test whether this still leads to crashes on the other architectures, but I would guess it does.
Although this probably won't have much impact anymore, because building a fat apk is not reccomended anyways.
So if anyone else has this issue: a feasible workaround should be to build split apks with flutter build apk --split-per-abi, each of the resulting apks then has all *.so files for the corresponding ABI.

@yoavrofe
Copy link
Collaborator Author

I Just use build an appbundle or use --split-per-abi. Closing this at this time since, as you noted,

Although this probably won't have much impact anymore, because building a fat apk is not reccomended anyways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android bug Something isn't working crash
Projects
None yet
Development

No branches or pull requests

3 participants