19 Aug 2017

Step 2. Create Android Mobile App Project Structure into root directory and sub directories

In Windows, create a directory/folder called AndroidApps  in  'D' drive......D:\AndroidApps\.
This will be root directory of our Project. What is our Project? Say our project is to design as many apps as we can for Android-Mobiles.

<Project Directory>
D:\AndroidApps\>
  • appNo.1
    • src
      • main
        • java
          • com
            • pkg
              • App.java
        • res
          • drawable
            • ic_launcher.png
          • layout
            • main.xml
          • values
            • strings.xml
            • attrs.xml
        • assets
          • fonts
        • AndroidManifest.xml
      • androidTest
  • appNo.2
  • appNo.3

To create above directory structure in root directory, we issue a one-line command at MS Dos Shell Command Prompt :-

D:\>android create project --name AndroidApps  --path D:\AndroidApps --package srivastav.animesh  --activity AppNo.1 --target android-23 --gradle --gradle-version 1.5.0

What is gradle in above command?
gradle is a command-line tool which automates the task of compiling the java text code files *.java  into  *.class byte code and then to *.dex dalvik language of androids. Then packaging it with images, audio, etc resources into a *.apk file and install in to mobile.

Now what is gradle version 1.5.0?
This is a android plug .... so we have connected android with gradle by the inserting a plug of gradle version 1.5.0 into the switchboard of Android installed in our Windows Operating System.

But why the version is 1.5.0?
This plug version is compatible with java version 1.6 which is compiling android java codes.

Now, although we have created an android project directory structure, its not required to use gradle to build apk. We can use other tool called 'Ant' or we can manually do it ourselves by using installed android's commands.



No comments:

Post a Comment