Tuesday, May 5, 2020

How to develop an android app using IntelliJ IDEA

For a long time, I wanted to learn how to develop android applications. I had Intellij IDEA (2020.1 community edition) installed in my machine. I followed below mentioned steps to develop a simple android app.

In Intellij IDEA, select File | New | project.

From new project window you can select Android project type. When you select that, in right side you can select the preferred activity type.
If you don't have Android SDK installed in your machine, you will get a different link to install it first.

When you select the activity type and enter the necessary details, intellij will auto generate the project for you.

Then you might need to run the application and test the app you just created. You can either use Android emulator or the real device. I preferred to use the real device. Following are the configurations that I needed to do before using real device for testing.

1.  Enable developer mode in your real device
     Settings | System | About phone and tap seven times on build number.
2. Enable USB Debug in your real device
     When you enable the developer mode, you will see a new item called  developer options in your settings. Open it and enable the USB debugging.

My device is a Huawei Nova 2i phone and I had to face some difficulties to get it listed under available devices. USB debug option was getting disabled automatically and I had to follow below mentioned steps to fix it.

  1. After connecting android device via usb cable, enable the "transfer files" option.
  2. Then enable USB debug in developer option menu.
After the above configurations, go back to your IDE and select the target device for your app.


Now all you have to do is run it.

You will see a new app in your device and it will be open by default.

Good luck with your android development!!