Online Tool to Generate iOS/Android Starter Project
Tags: kotlin, java, ios, android
Published: 2021-03-30 13:56:19

---
canonical_url: https://sjhannah.com/blog/2021/03/30/preview-online-tool-to-generate-iosandroid-app-starter-project/
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4jwe85ey9iu2aq2235m5.png
published: true
---

The [Codename One initializr](https://start.codenameone.com) is an online tool for generating a Codename One starter project. You can select either Kotlin or Java, then you can download the project and open it in your local IDE.

In this 5-minute video I use the initializr to generate a bare-bones Java project, which I open and run in IntelliJ. I also give a brief tour of the project structure and build targets.
{% youtube XuS1-SV0RkQ %}

## TLDW (Too Long Didn't Watch):

Here's the gist. Go to [Codename One initializr][1], select either the "Java Bare-bones Project" or "Kotlin Bare-bones Project" from the "Template" select box, and press "Download"

<img src="https://sjhannah.com/blog/wp-content/uploads/2021/03/Screen-Shot-2021-03-30-at-6.36.39-AM.png" alt="Screen Shot 2021-03-30 at 6.36.39 AM" width="291" height="430" class="aligncenter size-full wp-image-558" />

Extract the resulting project, and open it in IntelliJ (or your preferred IDE).

<img src="https://sjhannah.com/blog/wp-content/uploads/2021/03/Screen-Shot-2021-03-30-at-6.39.27-AM.png" alt="Screen Shot 2021-03-30 at 6.39.27 AM" width="642" height="362" class="aligncenter size-full wp-image-559" />

Press "Run" and wait while Maven downloads the build dependencies. It will open the Codename One simulator with the simple "Hello World" app running.

<img src="https://sjhannah.com/blog/wp-content/uploads/2021/03/Screen-Shot-2021-03-30-at-6.41.00-AM.png" alt="Screen Shot 2021-03-30 at 6.41.00 AM" width="311" height="499" class="aligncenter size-full wp-image-560" />

The project is a Maven project, with the following build targets:

*   iOS
*   Android
*   Mac Desktop
*   Windows Desktop
*   Javascript App
*   Windows UWP App,
*   JavaSE Desktop App
*   Xcode Project
*   Android Studio Project

In the video, I also demonstrate how to add a Button that, when clicked, opens a dialog. This is achieved by opening the *common/src/main/java/com/example/myapp/MyApp.java* file, and adding the following to the *start()* method:

    Button btn = new Button("Click Me");
    btn.addActionListener(evt->{
        Dialog.show("Hello World", "You Clicked Me", "OK", null);
    });
    hi.add(btn);
    

I'll soon be posting some follow-up videos to demonstrate how to build and deploy the project to iOS and Android devices, so watch the RSS feed or follow me (wherever you receive my posts), to be notified when these are posted.

## More Background

I've been working hard over the past several months to migrate Codename One from Ant to Maven. That process is [now complete][2], and it has enabled us to introduce a new, simpler workflow for creating Codename One projects. The [Codename One initializr][1] uses our Codename One App Project maven archetype to generate a starter project. Right now we just have two starter templates: Bare-bones projects for Java or Kotlin. We will be adding more templates soon, including some templates for full-featured apps that you can take and customize.

I've very proud of this work, and I'm excited about some of the new things that it will enable.

If you're a Java or Kotlin developer and you're interested in making cross-platform native mobile apps, you should give [Codename One][3] a try. You just might be surprised at how pleasant the experience is.

 [1]: https://start.codenameone.com
 [2]: https://www.codenameone.com/blog/moving-to-maven.html
 [3]: https://www.codenameone.com