IDEs are big. Older phones are small. How can we make this work?
One challenge in porting a full IDE to a low-cost phone is size: the app must be small enough to download in a reasonable time, and it must use space efficiently when it is running. “Efficiently” is a tricky concept because phones don’t have a lot of space, and the space they have is slow to access, particularly on less-costly phones.
Our prototype of the Code on the Go APK is currently more than 1 GB, and each user project consumes nearly 1 GB of additional space on the phone. We’re committed to reducing this footprint.
Problem 1: Our APK takes up too much space
So far, we’ve found three easy ways to reduce the size of our APK:
- The way that we eliminated the need for a live Internet connection resulted in fifteen identical copies of Gradle at 120 MB each. We’re removing the redundant files and changing the build so only one copy of Gradle is needed.
- Our additions to the APK include full documentation for the IDE, including several open-source reference materials. As we’ve added these resources, we’ve learned that the APK builder’s default compression for text and images could be stronger—a different compression scheme could reduce the size of text files by ~90% and images by ~50%. Many images in the reference materials are created from vector art, so we might be able to reduce image size even more if we can get the original vector files.
- The APK includes Linux files for non-Android architectures such as IBM mainframes. Those files can be removed.
Those three changes should have a significant impact on APK size. When they’re fully implemented, we’ll investigate further options.
Problem 2: User projects are too big and too slow to initialize
In addition to reducing the size of the APK, we also need to reduce the size of user projects and make them open faster. Currently, there’s a delay when you create a new project (the length of the delay depends on the phone you’re using). It turns out that every time you can create a project, Gradle makes a copy of its compressed form (the 120 MB discussed above) and then generates an uncompressed copy that consumes another 650-800 MB. Worse, the uncompressed version is written to scarce internal Android storage.
We’re currently investigating whether new projects truly need their own fresh copies of compressed and uncompressed Gradle. Our goal is to end up with just one copy of Gradle in the APK installing one copy on the phone, which will free gigabytes of storage space and dramatically accelerate the creation of new projects. (It might be possible to run Gradle directly from the APK, eliminating another level of copying, but the benefit may not be worth the effort.)
For transparency and openness, we’ll keep posting about the technical challenges that we need to overcome. If you have any suggestions, comments, or questions about Code on the Go development, please let us know at [email protected].