Sugarizer APK builder is a simple way to generate and customize yourself Sugarizer for Android. It provides a way to generate an APK without any knowledge on Android development.
Note that Docker should be installed on your computer to use Sugarizer APK builder.
Sugarizer APK builder comes in the form of a runable Docker container. Here's the command to launch:
git clone https://github.com/llaske/sugarizer
git clone https://github.com/llaske/cordova-plugin-sugarizeros
sudo docker run --rm -it \
-v "`pwd`/sugarizer:/sugarizer" \
-v "`pwd`/cordova-plugin-sugarizeros:/cordova-plugin-sugarizeros" \
-v "`pwd`:/output" \
llaske/sugarizer-apkbuilder:latest
First, you need to clone the Sugarizer repository, then the Cordova plugin for Sugarizer.
Finally run the docker container llaske/sugarizer-apkbuilder:latest with few arguments:
--rmtell to docker to discard the container at the end of build (optional but recommanded),-itto run the container interactively (optional),-v ./sugarizer:/sugarizeris to attach a volume where the container will find Sugarizer,-v ./cordova-plugin-sugarizeros:/cordova-plugin-sugarizerosis to attach a volume where the container will find the Cordova plugin to build Sugarizer OS,-v .:/outputis to attach a volume where the generated APK will be copied.
At the end of the process (could take more than 10 minutes) you will find a sugarizer.apk or a sugarizeros.apk in the output directory.
Few arguments could be add at the end of the docker command:
osto generate Sugarizer OS - i.e. Sugarizer as a launcher - instead of Sugarizer,fullto avoid the minify JavaScript step. Build will be quicker but JavaScript code will not be optimized,minsizeto reduce size of package by removing local resources in Abecedarium and Scratch,releaseto generate an APK without debug information,signsame thanreleasebut sign the APK at the end of generation,exclude-activitiesto exclude some activities from the APK (see Change activity set below).
If you're using the sign option you have to provide several environment variables to docker:
SUGARIZER_KEYSTOREFILEis the name of the keystore file, should be located in the directory where the APK will be generated,SUGARIZER_STOREALIASis the alias used by the keystore file,SUGARIZER_STOREPASSis the password used by the keystore file.
To give the value to each variable, use the -e docker command. Here's an example:
sudo docker run --rm -it \
-v `pwd`/sugarizer:/sugarizer \
-v `pwd`/cordova-plugin-sugarizeros:/cordova-plugin-sugarizeros \
-v `pwd`:/output \
-e SUGARIZER_KEYSTOREFILE="sugarizer.keystore" \
-e SUGARIZER_STOREALIAS="myalias" \
-e SUGARIZER_STOREPASS="mypassword" \
llaske/sugarizer-apkbuilder:latest sign
Customizing your Sugarizer APK could be interesting in many ways. Here's few use cases and how to solve them with Sugarizer APK Builder.
By default Sugarizer try to contact http://server.sugarizer.org when the connection dialog is launched. You could replace this default server URL by your own URL, for example if you need to access to a local server.
To do that, before launching the docker command, update file sugarizer/js/constant.js in line 61:
constant.defaultServer = constant.http + "server.sugarizer.org";
Replace string server.sugarizer.org by URL of your own server. If your server use HTTPS, replace constant.http by constant.https.
Finally, launch the usual docker command.
You could customize the set of activities visible by default on the Sugarizer home view. Let's suppose for example that you want to hide the Tank Operation activity.
To do that, before launching the docker command, update file sugarizer/activities.json in line 19:
{"id": "org.olpcfrance.TankOp", "name": "Tank Operation", "version": 1, "directory": "activities/TankOp.activity", "icon": "activity/activity-icon.svg", "favorite": true, "activityId": null},
Replace string "favorite": true by "favorite": false. You could change visibility of other activities in the same way.
Finally, launch the usual docker command.
You could customize the set of activities provided with Sugarizer to optimize size of the final APK file. Let's suppose for example that you want to remove the Abecedarium and the TurtleBlocksJS activities.
To do that, you could use the exclude-activities parameter. The value following this parameter is the list of activity names to exclude, separated by commas without spaces.
So to exclude Abecedarium and TurtleBlockJS activities, launch the docker command:
sudo docker run --rm -it \
-v `pwd`/sugarizer:/sugarizer \
-v `pwd`/cordova-plugin-sugarizeros:/cordova-plugin-sugarizeros \
-v `pwd`:/output \
llaske/sugarizer-apkbuilder:latest exclude-activities=Abecedarium,TurtleBlocksJS
Note that the activity name is the directory name where the activity is located without the .activity suffix. So for example, EbookReader for EbookReader.activity.
If you want to understand how the APK builder docker container works, you could find docker source here.
Sugarizer APK builder is licensed under the Apache v2 license. See LICENSE for full license text.
