How ChatGPT Helped Me Create My First Android App in 15 Hours

As someone who has been part of the technology industry for over 20 years, I have seen the evolution of software development from various perspectives. My journey includes more than a decade in management positions, leading teams, and driving technological innovations. Despite my extensive experience, I had never delved into Android development or coding in Java, though in my earlier experience, some of my teams have worked on Android and Java. So, I had basic knowledge about these technologies. I wanted to experiment with coding with ChatGPT to understand, if I could build an Android app using the same. Here’s how I did it.

The Initial Challenge

Having a good experience in object-oriented programming (OOP) and experience in C#, I was familiar with the fundamental concepts of programming. However, I didn't have any hands-on experience on Android development and Java. The idea of creating an app from scratch seemed daunting, especially given my lack of experience in this specific area. That’s when I turned to ChatGPT for assistance for implementing an idea of developing “Greetings” App.

Learning Prompt Engineering

As I was new to ChatGPT, I first wanted to learn the basics of prompt engineering so I could efficiently use ChatGPT for my experiment on programming. I took a few basic prompt-engineering courses on YouTube and spent around three hours on the same.

Setting Up Android Studio and Basics

The first step was setting up my development environment. I needed to install Android Studio and configure it. I had known a bit about Android Studio earlier, so it took around one hour, and I didn’t really need any help from ChatGPT for setting it up. I also had some understanding of the core components of an Android app, such as Controls, Activities, Layouts, and Resources from my prior experience managing the development teams.

Implementing Functionality (This is where ChatGPT was most helpful)

I had a clear understanding of the expected functionality from “Greetings” App, so I started by defining the core features my app needed. I first wanted to ensure that clear functional requirements were documented in a step-by-step process and used as a prompt in ChatGPT, which took me around one hour. This, I believe, is the most important step in getting the intended and quality output from ChatGPT.

In my interactions with ChatGPT, I learned how to handle user inputs, code events & functions, and navigate between different screens. For instance, ChatGPT guided me through setting up event listeners for buttons, enabling them to respond to user actions. It provided clear code snippets of how to write the corresponding Java code, explaining the logic step-by-step.

However, when I applied the code in Android Studio and built it, the code threw build errors multiple times. It was not a cakewalk to simply copy-paste the code for the application to start working. I had to interact with ChatGPT multiple times before getting the code ready and making it bug-free. However, each time I received a build error, I turned back to ChatGPT for solving the error and ChatGPT broke down the concepts into manageable parts. Each time I hit a roadblock, ChatGPT offered immediate solutions and alternative approaches, allowing me to maintain steady progress. At one point, ChatGPT was not able to resolve a problem related to a screen layout, and after trying different approaches, it could not produce a workable solution so I had to change the screen layout a bit in expectation of resolving the issue, which ChatGPT successfully did on the first try.

Overall, writing and debugging the core functionality took about ten hours. The real-time feedback and tailored explanations from ChatGPT were crucial in transforming my high-level understanding of programming into practical Android development skills. By the end of this phase, I had a functional app that responded to user interactions as intended.

Below some screenshots from the app

Source code link on GitHub

Points to Note

  • I used ChatGPT-4 and wrote 90% of the code with its help.

  • Before using ChatGPT for coding, it’s important to clearly understand the requirement and frame the prompt.

  • The quality of responses improves drastically by providing detailed and clearer prompts.

  • ChatGPT is not perfect. It can produce faulty code which can be debugged by further conversations.

  • I used Midjourney and Canva for generating the images required for my app. The time taken in learning Midjourney and generating the images is not included in the 15 hours.

Conclusion

Building my first Android app in just 15 hours (including learning basics of prompt engineering) was a remarkable experience. ChatGPT proved to be an exceptional guide, bridging the gap between my existing programming knowledge and the new skills required for Android development. For anyone hesitant to embark on a new technical venture, I recommend leveraging the capabilities of ChatGPT — it might just surprise you how quickly you can achieve your goals.

0
Subscribe to my newsletter

Read articles from Raj Darshan Pachori directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Raj Darshan Pachori
Raj Darshan Pachori