I assume that by now you would have installed your preferred way of development environment. I have a way with eclipse and hence would be using the same for further development. It is usually convenient to work on some editor that we are accustomed to. Now, that being said, I have also installed Android Studio to explore it. There is no harm in doing the same.
Now, lets get to the main point of discussion today - Project Creation. As with all other applications, we will want ourselves to build the very first "Hello World" Application.
At present there are three ways of project creation that we will talk about.
- Using SDK
- Using ADT
- Using Studio
Creation of a project using the SDK can include a bit more verbosity than the other ways. I would only recommend the same if you need more control on build or project creation than what an editor provides. For example, only if you have build scripts etc. For development purpose please use either ADT or Studio. They will not only provide help for starters etc. but also, render development real quick.
Of course, needless to mention that the above are my opinions and I leave it to the reader to have his own. I will be using Eclipse ADT more for development.
Lets start by creating a project using the three methods.
Note: if you are setting the path the please add platform-tools/ as well to the path environment.
1. You would need target Id to create Android project. To see the available targets installed run the following command.
Available Android targets:
----------
id: 1 or "android-19"
Name: Android 4.4.2
Type: Platform
API level: 19
Revision: 3
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : default/armeabi-v7a
If the available targets are not as desired you may need to install them using the link.
2. After you have identified the targets you can create the project.
Run the following command
android create project --target 1 --name TheFirstOne --path C:/Projects/TheFirstOne --activity MainActivity --package org.ram.thefirstone
I have created the project using target 1 that I could see using the list target command in step1.
After the successful run I can see the following output
Created project directory: C:\Projects\TheFirstOne
Created directory C:\Projects\TheFirstOne\src\org\ram\thefirstone
Added file C:\Projects\TheFirstOne\src\org\ram\thefirstone\MainActivity.java
Created directory C:\Projects\TheFirstOne\res
Created directory C:\Projects\TheFirstOne\bin
Created directory C:\Projects\TheFirstOne\libs
Created directory C:\Projects\TheFirstOne\res\values
Added file C:\Projects\TheFirstOne\res\values\strings.xml
Created directory C:\Projects\TheFirstOne\res\layout
Added file C:\Projects\TheFirstOne\res\layout\main.xml
Created directory C:\Projects\TheFirstOne\res\drawable-xhdpi
Created directory C:\Projects\TheFirstOne\res\drawable-hdpi
Created directory C:\Projects\TheFirstOne\res\drawable-mdpi
Created directory C:\Projects\TheFirstOne\res\drawable-ldpi
Added file C:\Projects\TheFirstOne\AndroidManifest.xml
Added file C:\Projects\TheFirstOne\build.xml
Added file C:\Projects\TheFirstOne\proguard-project.txt
The project is now successfully created. Congratulations !!!
The complete project directory can be seen above. We discuss the details of the structure shortly. Thst is it. You have created your first project.
1. Go to File, New, select Android Project as shown above.
2. Add the Application Name in the textfield provided next to the Application Name Label. Project Name and package name are auto filled.
3. Rest of the labels are quite intuitive. There is also description that is available for all the fields that are required to be fill. Still I'll explain these later on. For now, put Target SDK as the max available.
4. After filling the fields Click next. You'll see the below screen.
5. Click Next. Leave all the fields as default.
6. For the above as well, leave all the fields as default and click next.
7. In the above screen select Blank activity and click next. We'll explain about the same shortly.
8. Finally the last screen, keep the default names and click Finish.
Now, your project will be created for you in ADT. If the creation is successful, the below screen will be visible.
The above displays the complete directory structure and to the right the fragment xml is opened.
The project is finally created and we can start development in ADT.
Note: There are some default files created. For now, leave them as it is. The details will be covered later.
We will cover the rest in the next blog. In this we have seen how to create an Android project using command line tools and ADT. In the next section we'll create projects Studio and would also cover some of the details we skipped here.
Of course, needless to mention that the above are my opinions and I leave it to the reader to have his own. I will be using Eclipse ADT more for development.
Lets start by creating a project using the three methods.
Using SDK
There are two ways of doing this. Either, you set your Android Home/tools directory to the path and run the required commands from anywhere on your computer or you navigate to the the Android Home/tools directory and run your desired commands from there itself.Note: if you are setting the path the please add platform-tools/ as well to the path environment.
1. You would need target Id to create Android project. To see the available targets installed run the following command.
android list targets
After you have run the same you'll see the installed targets on your computer.Available Android targets:
----------
id: 1 or "android-19"
Name: Android 4.4.2
Type: Platform
API level: 19
Revision: 3
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
Tag/ABIs : default/armeabi-v7a
If the available targets are not as desired you may need to install them using the link.
2. After you have identified the targets you can create the project.
Run the following command
android create project --target 1 --name TheFirstOne --path C:/Projects/TheFirstOne --activity MainActivity --package org.ram.thefirstone
I have created the project using target 1 that I could see using the list target command in step1.
After the successful run I can see the following output
Created project directory: C:\Projects\TheFirstOne
Created directory C:\Projects\TheFirstOne\src\org\ram\thefirstone
Added file C:\Projects\TheFirstOne\src\org\ram\thefirstone\MainActivity.java
Created directory C:\Projects\TheFirstOne\res
Created directory C:\Projects\TheFirstOne\bin
Created directory C:\Projects\TheFirstOne\libs
Created directory C:\Projects\TheFirstOne\res\values
Added file C:\Projects\TheFirstOne\res\values\strings.xml
Created directory C:\Projects\TheFirstOne\res\layout
Added file C:\Projects\TheFirstOne\res\layout\main.xml
Created directory C:\Projects\TheFirstOne\res\drawable-xhdpi
Created directory C:\Projects\TheFirstOne\res\drawable-hdpi
Created directory C:\Projects\TheFirstOne\res\drawable-mdpi
Created directory C:\Projects\TheFirstOne\res\drawable-ldpi
Added file C:\Projects\TheFirstOne\AndroidManifest.xml
Added file C:\Projects\TheFirstOne\build.xml
Added file C:\Projects\TheFirstOne\proguard-project.txt
The project is now successfully created. Congratulations !!!
![]() |
Project Directory |
The complete project directory can be seen above. We discuss the details of the structure shortly. Thst is it. You have created your first project.
Using ADT
Creating a project using ADT is also simple. Open ADT by double clicking the eclipse.exe file in /eclipse folder of your installation.![]() |
Add a Project using ADT |
![]() |
Project Details |
3. Rest of the labels are quite intuitive. There is also description that is available for all the fields that are required to be fill. Still I'll explain these later on. For now, put Target SDK as the max available.
4. After filling the fields Click next. You'll see the below screen.
![]() |
Project Details |
![]() |
Project Details |
![]() |
Project Details |
![]() |
Project Details |
8. Finally the last screen, keep the default names and click Finish.
Now, your project will be created for you in ADT. If the creation is successful, the below screen will be visible.
![]() |
Project Created |
The project is finally created and we can start development in ADT.
Note: There are some default files created. For now, leave them as it is. The details will be covered later.
We will cover the rest in the next blog. In this we have seen how to create an Android project using command line tools and ADT. In the next section we'll create projects Studio and would also cover some of the details we skipped here.