AI-powered Software Development: Building an Android App in Minutes

Sachin Bal
5 min readJun 19, 2024

--

Recently, I was intrigued with the capabilities of AI tools and I was keen to know as to whether I could develop a basic android app using the AI tools.

I had never ventured into the world of Android development. My objective was to create a simple app that could add two numbers. This seemingly straightforward task presented the perfect platform to experiment with AI tools.

As a first step, I developed an Android App with Android Studio. Using instructions from https://www.youtube.com/watch?v=XLt_moCoauw I created an app which will add two numbers. Taking instructions from the YouTube video, I could create the app, test it on an emulator and then I uploaded and installed on my android phone. A screenshot of the app is pasted below.

I then used chatGPT (https://chatgpt.com/) to generate Project Management Documents and used Code Copilot (https://chatgpt.com/g/g-2DQzU5UZl-code-copilot) to build the code for the Android App.

I created a prompt for chatGPT as follows “I have a simple project. The project is to develop a android app in kotlin. The scope of the project is as follows. Take two numbers as input and add them and display the result. This is a personal project so there is no client. I am the sole stakeholder of this project.

Please generate all the relevant project management documents for this project formatted in MS Word

The response from chatGPT was as follows

“For your project, you’ll need several key project management documents. Below are the documents we will create:

  1. Project Charter
  2. Requirements Specification
  3. Project Plan
  4. Risk Management Plan
  5. Test Plan
  6. User Manual

Let’s start with the Project Charter.”

It then generated all the documents from Project Charter to User Manual on the screen and then gave the message

“ will now generate these documents in MS Word format. Please give me a moment.

I have created and saved all the relevant project management documents for your simple Android app project. You can download them from the links below:”

I downloaded the documents in my project folder and then opened the Project Charter. I copied the relevant details from this document and then opened the Code Copilot.

I pasted the relevant details from Project Charter into Code Copilot

My prompt to the Code Copilot was

This project involves developing a basic Android application using Kotlin. The app will take two numbers as input, add them together, and display the result.

Project Objectives: Develop a user-friendly Android application to add two numbers. Display the correct sum of the input numbers. Calculate and display the sum of the two numbers.

The Code Copilot responded as given below

Let’s break down the steps to develop a basic Android application in Kotlin that takes two numbers as input, adds them together, and displays the result.

Plan

Set up the Project:
Create a new Android project in Android Studio.
Configure project settings and dependencies.

Design the User Interface:
Create a layout file with two EditText views for input, a Button for performing the addition, and a TextView to display the result.

Implement the Logic in the MainActivity:
Fetch the input from EditText views.
Perform the addition operation.
Display the result in the TextView.

Run and Test the Application:
Deploy the app to an emulator or physical device.
Verify the functionality.

Pseudocode

Set up the Project:
Open Android Studio.
Create a new project with an Empty Activity template.
Configure project settings (name, package, save location, etc.).

Design the User Interface:
Edit the activity_main.xml layout file.
Add two EditText views for number input.
Add a Button to trigger the addition.
Add a TextView to display the result.

Implement the Logic in the MainActivity:
In MainActivity.kt, fetch the input values from the EditText views when the button is clicked.
Convert input values to integers.
Add the two numbers.
Display the result in the TextView.

Final Code

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">

<EditText
android:id="@+id/number1EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter first number"
android:inputType="number" />

<EditText
android:id="@+id/number2EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter second number"
android:inputType="number" />

<Button
android:id="@+id/addButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Add" />

<TextView
android:id="@+id/resultTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp"
android:layout_marginTop="16dp" />

</LinearLayout>

MainActivity.kt

package com.example.simpleadder

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import android.widget.EditText
import android.widget.TextView
import android.widget.Toast

class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

val number1EditText: EditText = findViewById(R.id.number1EditText)
val number2EditText: EditText = findViewById(R.id.number2EditText)
val addButton: Button = findViewById(R.id.addButton)
val resultTextView: TextView = findViewById(R.id.resultTextView)

addButton.setOnClickListener {
val number1String = number1EditText.text.toString()
val number2String = number2EditText.text.toString()

if (number1String.isNotEmpty() && number2String.isNotEmpty()) {
val number1 = number1String.toInt()
val number2 = number2String.toInt()
val sum = number1 + number2

resultTextView.text = "Result: $sum"
} else {
Toast.makeText(this, "Please enter both numbers", Toast.LENGTH_SHORT).show()
}
}
}
}

I followed the instructions given by Code Copilot. The only difference was that instead of using “Empty Activity” template as suggested by Code Copilot, I used “Empty Views Activity” template as I had used the same while following the instructions in the YouTube video.

And I was amazed. The app build was perfect and I could also launch the app on the emulator. All this in 30 minutes or so.

I feel, that the future of software development companies hinges on a new team structure. A crucial role will be the prompt engineer, responsible for meticulously translating client requirements into clear and concise prompts for AI tools like Code Copilot. Once these prompts are crafted, the prompt engineer can utilize Code Copilot to generate the initial code. This generated code is then integrated into an Integrated Development Environment (IDE) like Android Studio.

Here, the software engineer takes center stage. Their expertise lies in evaluating whether the AI-generated code fulfills the client’s requirements. If adjustments are needed, the prompt engineer can refine the prompts and regenerate the code.

Once the core functionality is established, the test engineer steps in. They leverage AI-generated test plans to thoroughly test the application, identifying any potential bugs or areas lacking complete coverage. Through this collaborative approach, AI empowers each team member to focus on their area of strength, ultimately leading to a faster and more efficient development process.

I took nearly 2–3 hours to understand the Kotlin code from the YouTube video but could generate the same Kotlin code using Code Copilot in less than an hour.

After this exercise, I firmly believe that AI tools can help us to be more productive in our workplace.

--

--