app.LoadScript() works in development, but APK shows blank screen

138 views
Skip to first unread message

Gurudas Gaonkar

unread,
May 10, 2025, 8:20:38 AMMay 10
to DroidScript
Dear DroidScript Developer,

I have a project that uses app.LoadScript("https://my-hosting-url/script.js") and it works perfectly in the development environment. However, after building the APK with the following options enabled:

✓ Obfuscate Code

✓ Include System Assets


The app shows a blank screen when launched.

It seems that app.LoadScript() does not work correctly in the APK build with these options enabled, possibly due to code obfuscation or some security restrictions.

Can you please confirm:

1. Is app.LoadScript() from external URLs supported in release APK builds?


2. If not, is there a recommended alternative way to dynamically load external scripts after APK compilation?


3. Should we avoid obfuscation in such cases?



Looking forward to your support.

Thanks,
Gurudas Gaonkar
App Developer

Cemal

unread,
May 11, 2025, 7:40:39 AMMay 11
to DroidScript
Are you sure it is because of LoadScript? If possible, try without app.LoadScript, if not, download the script file to the project file and try loading it with app.Script and see if you have the same problem.

Gurudas Gaonkar

unread,
May 13, 2025, 11:24:26 AMMay 13
to DroidScript
Hi Cemal,

Thanks for your response.

Yes, I suspected the issue was with app.LoadScript() because everything works perfectly in development, but the APK shows a blank screen only when I enable Obfuscation. When I disable it, it works fine.

My intention is to load scripts dynamically from a server (e.g. https://mydomain.com/script.js) so I can make changes remotely without updating the APK every time.

Based on your suggestion, I plan to try downloading the script using app.HttpDownload() and then run it using app.Script() or eval(). This should allow dynamic updates while still being compatible with release builds.

I’ll also test with Obfuscation turned off to confirm the root cause.

Appreciate your help!

Thanks :)

Dave

unread,
May 14, 2025, 5:56:10 AMMay 14
to DroidScript
Hi Gurudas,

If your app works when obfuscation is turned off, then it is probably because the version of DS that you are using has an older obfuscator that cannot cope with very modern Javascript.  Please try the newer beta2 version (droidscript_v2.77b2.apk) found here - https://droidscript.org/download/v2.77/

You will need to update the APKBuilder from the 'Plugins' menu in the app after installing 2.77b2 over your current installation (don't uninstall).

Also make sure to backup your projects to GDrive regularly or just email yourself the SPK file.

Regards
David
Reply all
Reply to author
Forward
0 new messages