Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.

ScratchJr crashes when exporting a project #241

Closed
chrisgarrity opened this issue Feb 25, 2020 · 6 comments · Fixed by #404
Closed

ScratchJr crashes when exporting a project #241

chrisgarrity opened this issue Feb 25, 2020 · 6 comments · Fixed by #404

Comments

@chrisgarrity
Copy link
Contributor

Related to #140
Exporting a project requires duplicating all the resources to generate the zip (.sjr) file. If they run out of resources (memory or storage) the app crashes. Happens frequently with projects containing many sound recordings.

@yueyuzhao
Copy link
Contributor

Hi @chrisgarrity , since those resources are saved in files on user devices, how about rewrite the compress functionality with native methods (ie: iOS writing with OC and Android with java) ?

@chrisgarrity
Copy link
Contributor Author

@yueyuzhao that's probably the approach that we'd take. However, it would be good to confirm that the crash is due to running out of resources by causing it while debugging. Right now, it's still just our best guess.

@yueyuzhao
Copy link
Contributor

@chrisgarrity

This is also related to #31 . I'm working on this and here is the approach :

  1. Js: generate project.json and related asset file list
  2. Native: make a temp folder and write project.json and copy assets to it
  3. Native: compress the target folder to a zip and return its name
  4. Js: call native to share

@yueyuzhao
Copy link
Contributor

Hi @chrisgarrity , one more thing: if we switch zip to native code, we also need switch unzip to native code.

@chrisgarrity
Copy link
Contributor Author

@yueyuzhao that sounds like a good approach. Does it make sense to have a step remove the temp folder as well?

@yueyuzhao
Copy link
Contributor

@chrisgarrity

Does it make sense to have a step remove the temp folder as well?

Good question! The temp folder will be removed right after the zip file is created and the zip files shall be removed before creating a new one.

Another approach is we can remove the zip file after sharing done. But on one hand, on Android we will not be notified when sharing is done, on the other hand, if the user kill the app before sharing, we will lost the opportunity to clean it up.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants