Sunday, September 15, 2013

Installing Android Studio and creating a new Android project on Android Studio.

Android Studio IDE is launched at Google I/O 2013. Android Studio is based on  Intellij IDEA which aims to replace Eclipse + Android Developer Tools for Android development. And since Google itself is pushing it, it may catch up with eclipse soon.

Android has its pros and cons compared to eclipse.

+ Android Studio has better support for UI design and coding which comes handy when supporting devices of multiple resolutions.

+ Android Studio also has built in ProGuard and app-signing capabilities.

- As of now Android Studio cannot manage multiple projects in the same window. It opens a separate window for every project. I guess this is from Intellij IDEA and may not change soon.

- Gradle-based build support, but for users migrating from Eclipse this will be a learning curve.

Assuming Android SDK is already installed on your system,Download the latest version of Android Studio from Android Developer site. If not download the Android SDK.

http://developer.android.com/sdk/installing/studio.html


Launch the downloaded EXE file, android-studio-bundle-<version>.exe.
Follow the set up wizard instructions to complete the installation.


If JDK is not installed on your system, you will need to install latest version of Java also. Also you will need to set the system variables JDK_HOME and JAVA_HOME.


Choose whether you want to limit the installation for only your profile or all the users using the system.


Select the installation location.







Once the installation is completed, launch the IDE by clicking on the Android Studio from Programs.

Android Studio will launch displaying the below splash screen. It will take few seconds to launch the IDE.




Some times the Android Studio(mostly on older versions) may fail to launch displaying the following error.


To work around this issue, launch the Android Studio as Administrator.

In Android home screen, Select Configure --> Project Defaults --> Project Structure -- Android SDK and configure the paths to your JDK and Android SDK.



In the Android Studio home screen, click on 'New Project'.


Once you click on 'New Project', Android Studio will display the below screen for you to provide your application name, module name and package name. Also you can specify the Target SDK, Minimum required SDK, and the Android SDK version with which the application needs to be compiled with. And you specify one of the Android Studio's built in themes.


Next you will need to select the icons that will be displayed when the app is installed on devices. For now, let us leave them as it is and continue by clicking on Next.


Then you need to select which type of activity that needs to be created. Select the activity and click on Next. If you don't know which activity to choose, leave the Blank Activity as it is.


Change the activity names with your preferred activity names and click on Finish.


It will take some time to set up the project first time, since IDE will download several dependencies for gradle and indexing the project etc.


Click on the Run button from the IDE, to start running the project.


Then IDE will prompt you to select a device or emulator from the available list of devices or emulators configured on the system.


Here I have a android emulator android_2_3_3 configured on my system and I select that Android Virtual device and click on Ok.

It will take painfully long time to launch the emulator, if it is not launched earlier. It is recommended to start the emulator manually and choose that emulator from 'Choose a running device' option.




The HelloWorld application we created will be installed into the emulator/device and will be launched.



1 comment: