We finished the final major piece of the offline build offering that we announced in July!
This Sunday we will update the plugins to include this ability as an option. Once installed you can use the instructions below to install the offline build service.
In this post I’ll explain the process and then follow up with some expected questions/answers. If you have questions/comments about this process please use the comment section below.
We support iOS/Android targets for offline build and we require an Enterprise grade subscription as explained here.
| || If you signup for Enterprise and cancel you can still do the offline build. You won’t be able to update the builder though |
Prerequisites for iOS Builds
You need the following installed tools/versions for Codename One’s offline build process:
Mac ideally with El Capitan (the current version of Mac OS)
Oracle’s JDK 8
Cocoapods - in the terminal type
sudo gem install cocoapods --pre.
xcodeproj - in the terminal type
sudo gem install xcodeproj
Prerequisites for Android Builds
Android builds need the following:
To build offline you need to install the offline builder code which is a stripped down version of the build servers. When you install a version of the offline builder it maps to the time in which you downloaded it…
That means that features like versioned builds won’t work. You can download/keep multiple offline builders and toggle between them which is similar in scope.
E.g. if you installed an offline builder then installed a newer version and the newer version has a bug you can revert to the old version. Notice that the older version might not have features that exist in a newer version.
| || Installation requires an enterprise account, you might need to re-login in the Codename One Settings UI |
To install an offline builder open the Codename One Preferences (settings) UI by right clicking the project and selecting Codename One → Codname One Settings.
Figure 1. Open Codename One settings
| || Even though the settings are a part of a project, the offline build settings are global and apply to all the projects… |
Once the Codename One settings UI launches select the Offline Builds entry:
Figure 2. Offline build entry
This should launch the settings UI which would be blank the first time around:
Figure 3. Offline builds setting UI
When you ar e in this form you can press the download button to download the current version from the build server. If there is no update nothing will happen. If there is the latest version will download and tag with a version number/date.
You can see/change the selected version in this UI. This allows building against an older version. You can also delete older builds to save space.
Offline building is almost like building with the cloud. In the right click menu you can select one of the offline build targets as such:
Figure 4. The offline build targets
Once selected build generates a project under the
Open these directories in Android Studio or xcode to run/build in the native IDE to the device or native emulator/simulator.
| || Build deletes previous offline builds, if you want to keep the sources of a build you need to move it to a different directory! |
To get this to work with Android Studio you will need one more step. You will need to configure Android studio to use your local version of gradle 2.11 by following these steps:
Figure 5. Android Studio Preferences
Select Build, Execution, Deployment → Build Tools → Gradle
Select the Use Local gradle distribution
Press the … and pick your local gradle 2.11 install
Figure 6. Local gradle config
Should I use the Offline Builder?
Cloud build is far more convenient, simple. Doesn’t require any installs (other than the plugin) and is much faster.
We built this tool for developers who work in situations that prohibit cloud build. E.g. government, banking etc. where regulation is restrictive.
Can I Move/Backup my Builders?
We protect all the builders to avoid abuse. If you backup and restore on a new system the builders might stop working even if you are a paying enterprise customer.
Can I install the builders for all our developers?
Our licensing terms require a parallel developer seat for the Codename One developers in your company. If you have 5 Codename One developers they must all have an enterprise developer account to comply.
E.g. You can’t have one enterprise account and 4 basic accounts.
The reason behind this is simple, in the past we saw a lot of funneling from developers who built such a licensing structure.
What Happens if I Cancel?
If you cancel your enterprise subscription all your existing installed offline builders should work as before but you won’t be able to update them or get support for this.
When are Versions Released?
We will try to keep this in the same release pace as library updates i.e. once a week typically on a Friday.
Are Version Numbers Sequential?
They grow but we sometimes skip versions. Versions map to our cloud deployment versioning scheme and we might skip versions in some cases.
Why is this Feature Limited to Enterprise Subscribers?
This is a complex tool to support & maintain. SaaS has a well defined business model where we can reduce prices and maintenance costs.
Offline builds are more like a shrinkwrap business model in which case our pricing needs to align itself to shrinkwrap pricing models for long term sustainability.
The main use case this product tries to address is government and highly regulated industries who are in effect enterprise users.
How Different is the Code From Cloud Builds?
We use the same code as we do in the cloud build process with minor modifications in the process. Since the cloud servers are setup by us they work differently but should align reasonably well.