Fork us on GitHub

Different Icons

Using different icon designs for iOS/Android
Different Icons

Different Icons

When we designed the icon for the new Kitchen Sink demo we tried to use material design principals. We thought it would look reasonable on iOS but it looked awful. So we decided to adapt the design and create a separate yet similar icon for iOS.

This is actually quite common but many developers aren’t aware of how easy it is to do these sort of things. The build process for Codename One is mostly transparent and you can replace/customize pieces of it. In this case we edited the build.xml file and modified this build target:

<target name="build-for-ios-device" depends="clean,copy-ios-override,copy-libs,jar,clean-override">
        packageName = "${codename1.packageName}"
        mainClassName = "${codename1.mainName}"


We changed one line:


We also had to do the same change in the release target:

<target name="build-for-ios-device-release" depends="clean,copy-ios-override,copy-libs,jar,clean-override">

This is really convenient as it allows you to override and automate many stages of the build. Every device build has a target and you can modify things such as which files get packaged.

XML Updates

The pitfall with this technique is that XML files are updated occasionally. The Codename One Settings application or the IDE preferences will detect out of date build.xml files and offer to update them, this might be required to take advantage of newer features such as offline build…​

This update will eliminate your changes so you will need to reintegrate them. If you have many changes just move them to an external file that you can include in the right spot so re-integrating changes is easy. Also make sure to keep the build.xml in version control so an accidental overwrite won’t destroy your work.

Share this Post:

Posted by Shai Almog

Shai is the co-founder of Codename One. He's been a professional programmer for over 25 years. During that time he has worked with dozens of companies including Sun Microsystems.
For more follow Shai on Twitter & github.