Friday, 3 July 2015

Want to create a basic app for Android ?

Ok then... Follow these steps to create a basic “Hello world” app.
1. First of all you need to have a framework and particular tool for developing. Either you can use Eclipse or Android studio as a framework. And also download latest SDK tools using  SDK manager.
(These are the links from where you can download framework and tools.
 For Eclipse  : https://eclipse.org/downloads/
 For Android studio:
https://developer.android.com/sdk/index.html
 For SDK tool : https://developer.android.com/sdk/index.html#top )
I suggest it is better to use Android studio.
2. See that your has jdk latest version. To see whether jdk installed in your computer goto cmd and type javac –version, if jdk is not installed or older versions of jdk is present then download jdk (http://www.oracle.com/technetwork/java/javase/downloads/index.html). After installing jdk check whether your Android studio or Eclipse and SDK manager are successfully installed. If they show any error message like launcher script does not find where Java is installed. Then you need to setup a path to current location Select Start menu > Computer > System Properties > Advanced System Properties. Then open Advanced tab > Environment Variables and add a new system variable JAVA_HOME that points to your jdk folder, for example C:\Program Files\Java\jdk1.7.0_21.
3.Launch Android studio or Eclipse framework so that you can enter into an environment where you can develop your first android app.
            ->Goto File > New project
                        A configure window will  appear give a name for the application for example “HelloWorld” and company domain as “helloworld.com” and project location is the space where you wish to store your project so provide project location and click on Next.


                       
4.Under Select the form factors your app will run on, select phone and tablet. After that select minimum SDK level i.e select Android 2.2 (API 8) then click NEXT.


5. After that under SELECT AN ACTIVITY  select BLANK ACTIVITY and click NEXT. Under Choose options for your new file, change the Activity Name to MyActivity. The Layout Name changes to activity_my, and the Title to MyActivity. The Menu Resource Name is menu_my. Click Finish button.

         
   

 


Your basic Hello World app is finished.

To see the output:
 
1. Create an AVD(Android Virtual Device)  goto Tools > Android > AVD Manager 
 
2. Click Create a virtual device, select any hardware device like Nexus 6 or Profile Nexus and click   on next.
  3.
Select version for your virtual device and click next  .
 
4. Click finish.
Now your AVD will be created.

5. Select the project and click on RUN button in toolbar.
6. In choose device window, click on Launch Emulator.
7. Now select the emulator, click OK.
   
           
It will take some time for the emulator to open, once it opens unlock the screen and you can find your app with the application name that you mentioned (here Helloworld), click on that Helloworld app in AVD and you can see your Hello World on that Virtual android phone.



Any problem in creating app, please comment I will help you. Thank You :-)

2 comments: