Solved — root cause:
The issue was a _cbMap.xxxxx is not a function error, and it only happened in the compiled APK/AAB, about 1 second after the app launched (never showed up when testing inside the DroidScript IDE).
The cause: on app startup, an asynchronous native call that fetches information from Google Play (think along the lines of a purchase/license status check) was being fired unconditionally, before the page had even fully finished loading. The native response for that call happened to arrive right during that same first second, while the app's own startup workload (script parsing, UI setup, event binding) was still in full swing. Under that load, DroidScript's native-JS bridge failed to match the callback correctly, and when it tried to invoke an entry it couldn't find in _cbMap, it threw the error — basically a classic race condition (timing conflict).
Why it only showed up in the APK and not the IDE: in the IDE preview, that native call doesn't establish a real service/server connection, so it just gets silently skipped. In a real signed APK, the connection is actually made and the async response actually comes back — which is exactly what triggered the error there and nowhere else.
Fix: delaying that startup call until the page has fully loaded and the main thread is idle (window.onload + a short setTimeout). That way, by the time the native response arrives, the bridge is "calm" and the callback matches up fine.
Summary: this wasn't a logic bug in the code — it was a timing conflict between an async native call fired too early at startup and the native callback bridge. If anyone else runs into this with a similarly early-firing native call, delaying it a bit usually fixes it.
9 Eylül 2026 Çarşamba tarihinde saat 23:54:15 UTC+3 itibarıyla Ferhat şunları yazdı: