This Android Studio Setup Tutorial is for beginner who are first time into Android and trying to setup Studio Environment. We have used Ubuntu Linux for our Tutorial and you can use the similar step for Windows OS as well.
For Android Development first we need an IDE (Integrated Development Environment) for coding and configuring application that we are going to develop.
Download Android Studio IDE
You can download Android Studio from Google’s developer page https://developer.android.com/studio/index.html
Extract the Downloaded zip by right click on the package and click on Extract Here
Goto android-studio/bin folder from the extracted place and copy the full path. We need to run studio.sh file to start Android studio IDE
Start Android Studio from Terminal
cd full path of bin directory and run studio.sh script using ./studio.sh command
Create a new project
Once the command is run you can see below screen popping up, please choose “start a new Android Studio project” option to start with.
Provide Application name as any name you wish to give. Here I have given app name as “FirstApp“.
Company name it is recommended to start with com and provide any name. Here I have given com.spicedroid
We can provide any package name but best practice is to start with company name “com.spicedroid” and append with any relevant name. Here I have given “com.spicedroid.myapp.demo”
Project location can be any location where you would like to save your generated physical project files and click on Next
Select Target Android Devices
Select “Phone and Tablet” and select minimum SDK as any API version you would like to make compatible with your app.
If you choose API 14 from the drop down then your app wont work devices having less than API 14 or Android 4.0 version installed.
I would recommend not to select lower API levels as many coding functions wont work in old API and we end up doing more coding to make it compatible and it will make our app unstable and complicated.
Click on Next
Add an Activity to Android Devices
Below is the selection of main screen/page view. It is showing a thumbnail of how the startup screen of your app would look like.
You can choose any Activity showing below but I would recommend to start with Empty Activity. Click on Next
Activity is a java class from were it actually perform actions. Here MainActivity is the class from were the application start performing the actions that we code. Below screen gives an option to modify the name of Activity and its layout name but for this example we are using default names. Click on Finish to create a new project.
It will take few seconds to generate all necessary files and project structure for us.
Project Workspace of Android Studio IDE
Once the file generation is completed it will automatically shows the IDE workspace for our project.
Click on Project option on the left most side and that will expand the project window. Then click on app and drill down till MainActivity. Now you can see the generated code to start with our first project.
Run the sample code
To test the project we have created do right click on MainActivity class and select Run MainActivity option.
Connect with Real Android Devices
Select Deployment target window will popup from were we need to select the Android devices connected to the system we are working on.
If this is not showing any devices then reconnect to the android device and goto settings -> About Phone -> tap on “Build Number” few times till you sett developer option is enabled message on the screen.
Once developer option is enabled the come back to Settings -> Developer options -> select “USB Debugging”
After enabling this you may get popup message saying Accept/Decline connection request from your system and you should accept the connection request.
If Accept/Decline popup didn’t come then try reconnecting the device and it may ask you to connect.
After clicking on Ok button your application will be automatically deployed to your Android device and shows the application the screen like below.
You can also go through the link to learn how to develop a meaningful function in this sample app which will do some real world problem.