About extracting zip files

119 views
Skip to first unread message

Fatih Elitas

unread,
Feb 6, 2026, 1:43:20 PMFeb 6
to DroidScript
DroidScript works fine with code, but it doesn't work when I create an APK. It doesn't extract the contents of the zip file. Where could the problem be? Is there a bug in the APK generator?

 ds 2.79.1
adndroid 12

function OnStart()
{
    app.UnzipFile( "yourfile.zip", "/sdcard/Extracted" );
}

Alan Hendry

unread,
Feb 6, 2026, 4:49:56 PMFeb 6
to DroidScript
HI,
My first instinct would be scoped storage.
Have you looked at GetPermission?
Regards, ah

Dave

unread,
Feb 9, 2026, 4:22:44 AMFeb 9
to DroidScript
I don't think it will create the target folder for you.  Did you try this - 

function OnStart()
{
    app.MakeFolder( "/sdcard/Extracted"  )
    app.UnzipFile( "yourfile.zip", "/sdcard/Extracted" );
}

Note: on a scoped storage device (Android 10+) "/sdcard/*" paths will point to the /Android/data/[packagename].... path

Fatih Elitas

unread,
Feb 17, 2026, 4:27:31 PMFeb 17
to DroidScript
Hi Dave;

The code works in the SPK file, but it doesn't work when creating the APK.

9 Şubat 2026 Pazartesi tarihinde saat 12:22:44 UTC+3 itibarıyla Dave şunları yazdı:

Dave

unread,
Feb 22, 2026, 6:56:02 AM (10 days ago) Feb 22
to DroidScript
It might be the case that the Android zip function don't work from APK resources.  

This means you will need to extract the file from resources first, using the app.ExtractAssets method, then unzip it and delete the zip file afterwards

Dave

unread,
Feb 22, 2026, 6:57:33 AM (10 days ago) Feb 22
to DroidScript
Note: The app.CopyFile method should also work and might be easier to use that app.ExtractAssets for a single file.
Reply all
Reply to author
Forward
0 new messages