First Application in Android Studio
Android Studio is a new Android development environment based on IntelliJ IDEA. Similar to Eclipse with the ADT Plugin, Android Studio provides integrated Android developer tools for development and debugging. On top of the capabilities you expect from IntelliJ, Android Studio offers:
- Gradle-based build support.
- Android-specific refactoring and quick fixes.
- Lint tools to catch performance, usability, version compatibility and other problems.
- ProGuard and app-signing capabilities.
- Template-based wizards to create common Android designs and components.
- A rich layout editor that allows you to drag-and-drop UI components, preview layouts on multiple screen configurations, and much more.
Android Studio Installation:
You can download Android Studio from Google’s Developers’ following site.
To get installation guide, visit Getting Started With Android Studio.
Have Execution Problem?
After following all the necessary steps to install Android Studio, you are facing problem to run it? I faced problem and find solution which I wrote at Android Studio not Starting Up After Installation.
First step towards Application
Open Android Studio. Which will display following after initialization.
You can see there are 6 tabs there.
<![if !supportLists]>1) <![endif]>New Project
Use to create a new project which android parameters
<![if !supportLists]>2) <![endif]>Import Project
Import Android projects from same or other work space.
<![if !supportLists]>3) <![endif]>Open Project
Open Projects from Directory
<![if !supportLists]>4) <![endif]>Check out from Version Control
If your Android Studio has configured with Sub-version, you can check-out it.
<![if !supportLists]>5) <![endif]>Configure
Here you can do settings of plug-ins, import-export settings and many more.
<![if !supportLists]>6) <![endif]>Docs and How-Tos
You will get help related Studio, tips, key map reference etc.
Step 1: Click on “New Project”
This will open following screen. I have filled it with required information. So do so.
When you fill your Application name, package name will be like com.example.anstudapp in your case, which I changed it with com.anstud. You can change package name as per your requirement.
<![if !supportLists]>1) <![endif]>Application Name
The application name is shown in Play store, as well as Manage Application list in settings.
<![if !supportLists]>2) <![endif]>Module Name
Module name is used by only Android Studio IDE. Generally module name is same as Application name.
<![if !supportLists]>3) <![endif]>Package name
Package name is unique identifier of your application. Carefully choose while defining package name for real time application which will uploaded to play store. Play Store will not accept different application with same package name (which is defined in AndroidManifest.xml file).
<![if !supportLists]>4) <![endif]>Project location
Select your work space where you want to put this project inside.
<![if !supportLists]>5) <![endif]>Minimum SDK version
Choose lowest version of Android SDK supported by your application.
<![if !supportLists]>6) <![endif]>Target SDK Version
Choose highest version of Android SDK supported by your application. Target version is that Application is known to work with.
<![if !supportLists]>7) <![endif]>Compile with
Choose API to compile your Target SDK.
<![if !supportLists]>8) <![endif]>Theme
Select Base theme of your application.
<![if !supportLists]>9) <![endif]>Create Custom Launcher Icon
If you like to define custom launcher icon in this wizard, select this option
<![if !supportLists]>10) <![endif]>Create an Activity
If you like to create activity from default selection, check this option.
<![if !supportLists]>11) <![endif]>Mark this project as a Library
If you are creating a library, you need to select this option. This project will allow you to refer itself to other project.
Step 2: Click Next to Create custom launcher icon
If you have not selected this option in previous screen, you are not able to define custom launcher icon and text in this wizard. Still you can define manually after project creation.
You can also select “custom image” from Clipart.
You can also select option “Text” to set launcher text icon like following
Step 3: Click Next to Define Activity
This screen will let you select default sample activity like Blank Activity, Full Screen Activity, and Master/Detail Activity etc. If you have not selected this option in main screen, you are not able to select this default activity. You need to define new activity in your package yourself.
Step 4: Click Next to Create Main Activity
Now, you are at the last step to project creation. Give an Activity name in field, give layout name and if you like to select navigation like “Fixed Tab + Swipe” etc select option from drop down list.
Now, click on “Finish” button to complete this project wizard. This will next configure your new project settings. If “Gradle” is not installed in your disk, this will download all the dependencies before this. So wait until set up is finished. If package can’t be downloaded, go to “Configuration” screen, and find “HTTP Proxy” and check whether your internet connection is okay or not.
Next screen, after successfully configuration, will look like this.
Here, you can see that, our “MainActivity” is resided in “src/main/java/com.<package>/”. You can also see our resources structure. The layout file which we defined in “wizard” is here in “src/main/res/layout” directory.
When I open this layout file, following screen will open. I have made some changes in layout file.
When you go to “text view” of layout, you are able to view the changes you are making in text file, and output will immediately reflect to your design.
This Android Studio has one good facility called “Preview all screen Sizes”, which allow user to see the output of current layout file with all the supported devices simulate output.
You are almost done with all the things. Now, as you code in Eclipse, same do here. Run your project by selecting AVD or real device.
There are so many features in this IDE, will explore in my next article.
In this article, we learn how to create a new project using Android Studio’s Project wizard with different parameters. We learn new feature about layout and project structure.