STORAGE ISSUES WITH DROIDSCRIPT

145 views
Skip to first unread message

Samuel Victor

unread,
Jul 2, 2025, 11:03:37 AMJul 2
to DroidScript
Good day fam,
I'm currently working on a DroidScript app to meet a deadline for a client. I'm facing an issue with storage. In DroidScript as an spk it works just fine. When compiled to APK, the app also works on my android 8 phone, but when I tried it with an android 11 phone , the storage issues came up.
I created a server in the app to host locally and unfortunately, due to storage issues - the index.html displayed 404- not found. Please any help would be highly appreciated, as I'm struggling to meet the deadline 

Best Regards

Cemal

unread,
Jul 2, 2025, 12:12:09 PMJul 2
to DroidScript
How do you serve the index.html file? If you are extracting to a user's folder, you may have a Scoped Storage issue.

Alan Hendry

unread,
Jul 2, 2025, 12:26:03 PMJul 2
to DroidScript
HI, 
As Cemal indicates, scoped storage was introduced in Android 11.
It would probably help if you posted a few lines if code
showing where the index.html starts, where it is copied to (if copied),
the address it is served from.
Regards, ah

Cemal

unread,
Jul 2, 2025, 2:34:11 PMJul 2
to DroidScript
Someone emailed me and said it was a good idea to use a Private Folder.

// Create a hidden folder that only the app can access:
const serveFolder = app.GetPrivateFolder("serve")

// Extract the files from the folder you added to the APK and add them to the private folder.
app.ExtractAssets("[html project folder name]", serveFolder, true)

With app.IsNewVerison(), it makes more sense to extract only when the application is first installed and updated.

(Thanks to Kelechi Ekezie)

Alan Hendry

unread,
Jul 2, 2025, 3:07:39 PMJul 2
to DroidScript
HI, 
I'd probably try to break it down
Check if initial file exists
Extract Assets
Check if extracted file exists
Check if file exists just before trying to serve it
I presume you've seen the examples in the docs
Regards, ah

Alan Hendry

unread,
Jul 24, 2025, 7:58:39 AMJul 24
to DroidScript
HI,
There are 2 examples in the docs
(extracting a file and a folder).
Depending on scoped storage 
you may need to use a different destination
(and whether you want the user to be able to see the file(s).
Regards, ah
Reply all
Reply to author
Forward
0 new messages