Thursday , June 23 2022

Creating New Android Studio Project using Command Line Tools

Creating New Android Studio Project using Command Line Tools – Once the SDK Tools are installed and its “tools”, “platforms” and “platform-tools” directories are set in the Environment Variable named Path using SETX Command as above.

Creating New Android Studio Project using Command Line Tools

After that, we can also create our new Android project through Command Prompt using various Android Tools of Android SDK.

For example, suppose we want to create our first Android project in the “E: \ Softwares \ AndroApps” folder. Therefore, first we have to reach this path in our Command Prompt, for which we use CD Command as follows:

By reaching the Destination Folder of our project, now we first have to find out what target devices we can develop for our Android Project by executing the next command as follows. Able to develop Application for:

We can see that by executing the command “android list targets” on Command Prompt, we get a long list of supported Android Targets. This list gives an indication of which platforms our current Android SDK Tools supports, on which we can compile our Android Application.

The main thing to keep in mind here is that we should always compile our Android application only for the latest supported version platform, because if we will compile our application for the old version’s Android platform, then our application is new devices. But Run will not run while Compiled Application on the new platform remains Compatible on most of the old Platforms.

If no supported platform list is visible when executing “android list targets” command on Command Prompt, then in that case we need to download at least one Supported Android Platform and other related tools using Android SDK Manager Tool Otherwise we cannot create a new Android project unless there is a Particular Platform Exist.

Each supported platform has a unique ID in the list of supported platforms, which we can see in the above picture with the “id” Attribute. It is through this “id” Attribute that we decide on which platform we have to create our Android project.

After receiving the list of Supported Platforms as above, to create a new Android project for the latest supported platform, we now have to execute the following command on the Command Prompt:

In this command, as , we have to specify the ID of the supported platform for which we want to create our Android Application. While this ID can be obtained as shown in the previous picture.

In this command, as , we have to specify the path where we want to store the files of our Create Project.

For example when we execute this command on Command Prompt as follows:

android create project –target 12 –name MyFirstAndroidApp
–Path MyFirstAndroidApp –activity MyActivity
–Package com.bccfalna.myfirstandroidapp

As soon as we execute these commands, our Command Window Automatically creates some Files and Folders on our Current Path:

That is, when the above command is executed, then Create a Folder named “MyFirstAndroidApp” in the Current Directory (Path) and Automatically Create all the required files and Folders related to the Architecture of our Newly Create Android Project in this Folder. , So that we do not have to manually create all the necessary files and folders related to our Android Application Architecture at our level.

Although we can create them manually if we want, but in that case the chances of making a mistake increases greatly, due to which we may face a lot of difficulties in testing and debug our application.

The directory structure that is created in the above manner is actually a Architecture of a “Hello World” application which can be compiled and run and when run, it displays a “Hello World” Message on our device.

But before compiling this application, we have to configure the actual Android device on which we will run after compiling this application, because all Android applications run on some Android device only.

So, first, we configure our Android Device itself, so that the application we create can be tested by running on the actual device.

Read Also – Content Provider in Android – The Basic Fundamentals of Content Provider

About dmtechnolab

Check Also

Simplified Coding

Android Hilt Tutorial – Injecting Dependencies with Hilt – Android Coding by DMTechnolab

You are welcome Android Hilt tutorial. I hope you all are aware of it Dependency …

Leave a Reply

Your email address will not be published. Required fields are marked *