WARN: Unable to load JNA library (OS: Mac OS X 12.2) warning when running flutter app on release mode. (M1 Mac)
Asked Answered
O

3

23

I built a simple tic-tac-toe app on Flutter. It works in debug mode without any problem, but when I run it in release mode it gives me an error:

WARN: Unable to load JNA library (OS: Mac OS X 12.2)
java.lang.UnsatisfiedLinkError: /Users/rza/Library/Caches/JNA/temp/jna10193542212619812140.tmp: dlopen(/Users/rza/Library/Caches/JNA/temp/jna10193542212619812140.tmp, 0x0001): tried: '/Users/rza/Library/Caches/JNA/temp/jna10193542212619812140.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/lib/jna10193542212619812140.tmp' (no such file)

I'm running the app in release mode in a virtual Android machine.

I am assuming it is about CPU architecture. How can I fix this?

Opinionated answered 10/2, 2022 at 2:25 Comment(1)
Welcome to SO! Please take the tour and read "How to Ask", "Stack Overflow question checklist", "minimal reproducible example" and their linked pages. We can't help you debug without the smallest example of runnable code that demonstrates the problem.Kistler
P
41

Just had this error as well. This happens with flutter 2.10.1 on a mac with M1.

I got rid of it by doing a

$ flutter clean

in my project directory.

Preciado answered 10/2, 2022 at 15:22 Comment(3)
You are amazing thank you. But I would like to know how "flutter clean" works? Because the incompatible files are not located in project folder.Countryside
I don't know for sure what is done by flutter clean - however, it claims to clean up Xcode workspace which may include artifacts stored anywhere (as Xcode has a habit to store things in places one wouldn't expect or does even know that they exist). It cleans up several artifacts that may have been created during a previous flutter run or flutter build command and which may get reused by flutter upon further runs or builds. When migrating flutter to a new version it has a chance to resolve many issues encountered then.Atalanta
In my case this command broke some things (gradle custom config) and did not solve the problem.Gallonage
S
10

It's an issue with old build files. Just delete build files manually or run

flutter clean

Submersed answered 17/4, 2022 at 4:25 Comment(0)
D
0

for me also it it was happening because of a switch to new flutter version (using fvm tool) and having other version with old flutter version installed in the emulator

flutter clean helped for sure after this + uninstall the app on the emulator

Deangelis answered 17/9, 2023 at 15:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.