Pre-requisites
1) Cursor Editor is installed.
2) Android Studio is installed, with the latest Android SDK.
3) An Android Virtual Device is created.
In Android Studio
1) Create a blank Android app.
2) Let the gradle sync and indexing process complete.
3) (Optionally) Git init and create a baseline version.
4) Close Android Studio.
In Cursor Editor
1) Open the project directory that contains your Android App.
2) Use CMD + SHIFT + I to launch the AI composer.
3) Provide the prompt in the AI composer, such as:
@codebase Creating 4x4 tic tac toe game
Package Name: my.calvin.mygame
Language: Kotlin
Android: 30 and above
1) The user sees a landing screen that contains two buttons – New Game and Instruction
2) The instruction button shows a popup that describes the rules of the game.
3) The new game button shows the game screen – a 4x4 board, with a total of 16 boxes.
4) Two players (white and black) take turns tapping on the 4x4 board to occupy the box.
5) Boxes that are already occupied cannot be tapped again.
6) The first player that occupies 4 boxes horizontally, vertically, and diagonally wins the game.
7) When a player wins, a dialog box pops up to announce the winner and total moves.
8) Closing the dialog box to go back to the landing screen.
4) Click "send".
5) After ~5min, the process is completed, several files are modified and several others are created. Click "Accept All" to save them.
Test our App
1) Back to Android Studio and open the app again.
2) Click the "Play" button to run the app on a Virtual Device.
3) The build process fails with an error.
unexpected element <activity> found in <manifest>
4) The updated manifest file did not close the <application> tab correctly.
5) A quick modification is done, and we move the closing after the activities.
<activity
android:name=".GameActivity"
android:exported="false" />
</application>
</manifest>
6) Now the app runs successfully.
7) But what if you are not an Android developer (or you are not a developer)?
You can ask Cursor to fix it for you too! For example: