java.net member

Rechercher dans ce site

Loading...
Note:
Most of these plug-ins and articles are available completely for free! If you like them and/or find them useful, please donate any amount to keep this site actively developed

Si vous trouvez ces articles ou plug-ins utiles, n'hesitez pas a contribuer pour encourager l'auteur et garder le site actif n'importe quelle somme est la bienvenue

First Android Application on intelliJIDEA 12, Installing and Configuration

>> 08 February 2013

In this little tutor i will show you, step by step, how to install and configure JDK, Android SDK and intelliJIDEA to work together and create  your first Android application.

Used Softwares :
JDK 7u11
Fedora 17 (64 bits)
Android SDK android-sdk_r21.0.1-linux
intelliJIDEA 12 (both community and ultimate will do the job). Community Edition is a FOSS

Installing JDK

  • Go to the following URL
    http://www.oracle.com/technetwork/java/javase/downloads/index.html and download the JDK (aka JAVA SE) for your system.
  • I personally prefer the .gz file (when gunzipped you can have a folder for the JDK in your $HOME)
  • Gunzip the downloaded file
  • tar -zxvf fileName.gz
  • in .bashrc create a variable "JAVA_HOME". Add its "bin" sub folder to the path.

        
Installing Android SDK
  • Go the following URL http://developer.android.com/sdk/index.html and download one of the available SDKs for your system
  • gunzip the *.tgz file downloaded on android's site. This will give “android-sdk-linux” folder

Note:
Android SDK is only available for Linux (32 bits) and need some shared libraries to be installed on any Linux (64 bits) platforms.

Add some Android platforms
The Android SDK (recently) comes with no platform neither platform tools. Therefore you need to download one or more platforms.

Under android-sdk-linux folder go to tools folder. run android


Check one or more Android platforms to install. Check Android SDK Platform-tools (anyway this one will be installed automatically when a platform is chosen). Click on Install xxx packages button.





Configuration of AVD devices
To launch Android AVD Manger from the command line
run  android-sdk-linux/tools/android avd



Configuring the JDK on intelliJIDEA
Normally when the IDE is launched for the first time, it will ask you to configure the JDK. It didn't for me. If you're in the same case begin by telling the IDE where is your JDK

In the Welcome screen click on Configure


Select Project Defaults


Select Project Structure


Click on New... button


Select JDK, browse to your JDK folder > Select the folder > OK


Click OK when the JDK is configured


Note:
You can also configure from here the Android SDK, or you can wait to configure it when creating a new project (and thus choose the build target for the project)

Create a new Android project
From the Welcome screen > Create New Project (or File > New Project)


In New Project windows select Application Module under Android section (1). Give a name to this project (2). Click on New... button to select the Android SDK(3)


After selecting the Android SDK folder, you're invited to select your Build Target (what version of Android your application want to use) > Next(4)



Give a package name and be sure to check Create "Hello, World!" activity
Select Emulator as the target device. Note here that "ka_jellyBean" is selected. This one was created using Android AVD Manager. If you don't have, click on the ellipsis ... to create one


Under Project res/ layout/main.xml file defines the appearance of the application. Double click on it will open Android UI Designer


When main.xml is in Text mode, it has a live demo screen that changes with every changes in main.xml (even without saving the file)


Change android:text attribut in TextView in main.xml file to be like the following

<TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="Hello World !!!"
            />
Running the Application
Before running the application, you need to configure (or verify the run configuration)
In Run menu > select Edit Configurations


In (1) select the Module you want to execute (normally the same name as the project)
Launch (2) is selected with the path to MyActivity (or any other name you have given to it)
Deploy Application must be checked (3)
Emulator (4) is selected
In (5) select AVD from the list. Or create a new one (6)
Click on OK when finished (7).



To run the application > click on play button


The emulator takes really long time to start. Be patient







Enjoy!





































Read more...

  © Blogger template Simple n' Sweet by Ourblogtemplates.com 2009

Back to TOP