ARTICLE AD BOX
I am facing random native crashes on Android when using the jyotish Flutter package (Swiss Ephemeris based).
The crash happens even when only initializing the package, without calling any calculation functions.
Environment:
Flutter: stable channel
Android: 11
Device: Xiaomi davinciin
ABI: arm64-v8a
Package: jyotish: 2.5.0
I already:
rebuilt libswisseph.so
linked math library (-lm)
fixed architecture mismatch
tested sequential execution only
removed concurrent calls
tested with minimal initialization
But the app still crashes randomly with native SIGSEGV/SIGBUS errors.
Current behavior:
Sometimes initialization succeeds
Sometimes app fully loads
Sometimes first calculation works
Then random native crash occurs later
Even if I only do:
final j = Jyotish(); final ephePath = await copyEpheFiles(); await j.initialize( ephemerisPath: ephePath, );the app may still crash later.
Minimal reproduction:
void main() async { WidgetsFlutterBinding.ensureInitialized(); try { final j = Jyotish(); final ephePath = await copyEpheFiles(); print("EPHE PATH: $ephePath"); await j.initialize( ephemerisPath: ephePath, ); print("JYOTISH INIT SUCCESS"); } catch (e, st) { print(e); print(st); } runApp( const MaterialApp( home: Scaffold( body: Center( child: Text("TEST"), ), ), ), ); }Ephemeris files:
copied from assets to application documents directory
all .se1 files provided
Example path:
/data/user/0/com.garden.gardenmakeover/app_flutter/epheCustom build command used for libswisseph.so:
aarch64-linux-android21-clang.cmd ^ -shared ^ -fPIC ^ -O0 ^ -g ^ -fno-builtin ^ -DANDROID ^ -o libswisseph.so ^ compat.c ^ swecl.c ^ swedate.c ^ swehel.c ^ swehouse.c ^ swejpl.c ^ swemmoon.c ^ swemplan.c ^ sweph.c ^ swephlib.c ^ -lmEarlier issues already solved:
Wrong architecture: EM_X86_64 instead of EM_AARCH64 Missing math linkage: cannot locate symbol "asin"After fixing those, crashes still happen.
Typical crash logs:
Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR)or
Fatal signal 7 (SIGBUS), code 1 (BUS_ADRALN)Example stack:
#00 pc ... (sincos+4) #01 pc ... (sincos+32)or
F/libc: Fatal signal 11 (SIGSEGV) fault addr 0x7c08200000Important observations:
crash is random
note that this package has one bug in setup mentioned in repo while setup
same code sometimes works perfectly
crash occurs even without calculations
hot reload/hot restart increases crash frequency
app may fully render UI before crashing
