Introduction to Android Development: A Comprehensive Guide for Beginners, Study notes of Computer science

A comprehensive introduction to android development, covering essential concepts, tools, and techniques. It guides beginners through the process of setting up the android sdk, creating virtual devices, and building their first android application. The document also explores key aspects of android architecture, including the linux kernel, android runtime, and application framework. It further delves into the use of the android emulator for testing and debugging applications.

Typology: Study notes

2021/2022

Uploaded on 02/04/2025

alwin-john
alwin-john 🇮🇳

1 document

1 / 22

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Unit 1
Introduction to Android
Syllabus: The Android 4.1 jelly Bean SDK, Understanding the Android Software Stack, installing the
Android SDK, Creating Android Virtual Devices, Creating the First Android Project, Using the Text view
Control, Using the Android Emulator, The Android Debug Bridge(ADB), Launching Android Applications
on a Handset.
INTRODUCTION
When we talked about operating systems few years ago, the most common answers
were Windows, Linux, and mac operating system. However, with the undying competition in the
mobile phones market, the next big thing entered was ANDROID, which in no time became the
heart of smart phones. Android provides a rich application framework that allows you to build
innovative apps and games for mobile devices in a Java language environment.
Android is a mobile operating system developed by Google, based on a modified version of the
Linux kernel and other open source software and designed primarily for touch screen mobile devices
such as smart phones and tablets. In addition, Google has further developed Android TV for televisions,
Android Auto for cars, and Wear OS for wrist watches, each with a specialized user interface. Variants of
Android are also used on game consoles, digital cameras, PCs and other electronics.
The Android Operating System is a Linux-based OS developed by the Open Handset Alliance
(OHA). The Android OS was originally created by Android, Inc., which was bought by Google in 2005.
Google teamed up with other companies to form the Open Handset Alliance (OHA), which has become
responsible for the continued development of the Android OS.
The android is a powerful operating system and it supports large number of applications in
Smart phones. These applications are more comfortable and advanced for the users. The hardware that
supports android software is based on ARM architecture platform. The android is an open source
operating system means that it’s free and any one can use it.
The android has got millions of apps available that can help you managing your life one or other
way and it is available low cost in market at that reasons android is very popular.
Each time the OHA releases an Android version, it names the release after a dessert. Android 1.5 is
known as Cupcake, 1.6 as Donut, 2.0/2.1 as Eclair, 2.2 as Froyo and 2.3 is dubbed Gingerbread. Once a
version is released, so is its source code.
The Android OS is designed for phones. The important features of android are given below:
1) It is open-source.
2) Anyone can customize the Android Platform.
3) There are a lot of mobile applications that can be chosen by the consumer.
4) It provides many interesting features like weather details, opening screen, live RSS (Really Simple
Syndication) feeds etc.
It provides support for messaging services(SMS and MMS), web browser, storage (SQLite), connectivity
(GSM, CDMA, Blue Tooth, Wi-Fi etc.), media, handset layout etc.
Software developers who want to create applications for the Android OS can download the Android
Software Development Kit (SDK) for a specific version. The SDK includes a debugger, libraries, an
emulator, some documentation, sample code and tutorials. For faster development, interested parties
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16

Partial preview of the text

Download Introduction to Android Development: A Comprehensive Guide for Beginners and more Study notes Computer science in PDF only on Docsity!

Unit 1

Introduction to Android

Syllabus: The Android 4.1 jelly Bean SDK, Understanding the Android Software Stack, installing the Android SDK, Creating Android Virtual Devices, Creating the First Android Project, Using the Text view Control, Using the Android Emulator, The Android Debug Bridge(ADB), Launching Android Applications on a Handset.

INTRODUCTION When we talked about operating systems few years ago, the most common answers were Windows, Linux, and mac operating system. However, with the undying competition in the mobile phones market, the next big thing entered was ANDROID, which in no time became the heart of smart phones. Android provides a rich application framework that allows you to build innovative apps and games for mobile devices in a Java language environment.

Android is a mobile operating system developed by Google, based on a modified version of the Linux kernel and other open source software and designed primarily for touch screen mobile devices such as smart phones and tablets. In addition, Google has further developed Android TV for televisions, Android Auto for cars, and Wear OS for wrist watches, each with a specialized user interface. Variants of Android are also used on game consoles, digital cameras, PCs and other electronics.

The Android Operating System is a Linux-based OS developed by the Open Handset Alliance (OHA). The Android OS was originally created by Android, Inc., which was bought by Google in 2005. Google teamed up with other companies to form the Open Handset Alliance (OHA), which has become responsible for the continued development of the Android OS.

The android is a powerful operating system and it supports large number of applications in Smart phones. These applications are more comfortable and advanced for the users. The hardware that supports android software is based on ARM architecture platform. The android is an open source operating system means that it’s free and any one can use it.

The android has got millions of apps available that can help you managing your life one or other way and it is available low cost in market at that reasons android is very popular.

Each time the OHA releases an Android version, it names the release after a dessert. Android 1.5 is known as Cupcake, 1.6 as Donut, 2.0/2.1 as Eclair, 2.2 as Froyo and 2.3 is dubbed Gingerbread. Once a version is released, so is its source code.

The Android OS is designed for phones. The important features of android are given below:

  1. It is open-source.
  2. Anyone can customize the Android Platform.
  3. There are a lot of mobile applications that can be chosen by the consumer.
  4. It provides many interesting features like weather details, opening screen, live RSS (Really Simple Syndication) feeds etc. It provides support for messaging services(SMS and MMS), web browser, storage (SQLite), connectivity (GSM, CDMA, Blue Tooth, Wi-Fi etc.), media, handset layout etc.

Software developers who want to create applications for the Android OS can download the Android Software Development Kit (SDK) for a specific version. The SDK includes a debugger, libraries, an emulator, some documentation, sample code and tutorials. For faster development, interested parties

can use graphical integrated development environments (IDEs) such as Eclipse to write applications in Java.

Android Emulator:

The Emulator is a new application in android operating system. The emulator is a new prototype that is used to develop and test android applications without using any physical device.

The android emulator has all of the hardware and software features like mobile device except phone calls. It provides a variety of navigation and control keys. It also provides a screen to display your application. The emulators utilize the android virtual device configurations. Once your application is running on it, it can use services of the android platform to help other applications, access the network, play audio, video, store and retrieve the data.

Android versions: Google did not attach any high-calorie code name to its initial versions 1.0 and 1.

of the Android Operating System. The code names of android ranges from A to N currently, such as Aestro, Blender, Cupcake, Donut, Eclair, Froyo, Gingerbread, Honeycomb, Ice Cream Sandwitch, Jelly Bean, KitKat, Lollipop and Marshmallow. Let's understand the android history in a sequence.

UNDERSTANDING THE ANDROID SOFTWARE STACK/ Android Architecture

The Android operating system is built on top of a modified Linux kernel. The software stack contains Java applications running on top of a virtual machine. Components of the system are written in Java, C, C++, and XML. Android operating system is a stack of software components which is roughly divided into five sections

  1. Linux kernel
  2. Native libraries (middleware),
  3. Android Runtime
  4. Application Framework
  5. Applications

1) Linux kernel

It is the heart of android architecture that exists at the root of android architecture. Linux kernel is responsible for device drivers, power management, memory management, device management and resource access. This layer is the foundation of the Android Platform.

 Contains all low level drivers for various hardware components support.  Android Runtime relies on Linux Kernel for core system services like,  Memory, process management, threading etc.  Network stack  Driver model  Security and more.

2) Libraries

On top of Linux kernel there is a set of libraries including open-source Web browser engine WebKit, well known library libc, SQLite database which is a useful repository for storage and sharing of application data, libraries to play and record audio and video, SSL libraries responsible for Internet security etc.

SQLite Library used for data storage and light in terms of mobile memory footprints and task execution.  WebKit Library mainly provides Web Browsing engine and a lot more related features.  The surface manager library is responsible for rendering windows and drawing surfaces of various apps on the screen.  The media framework library provides media codecs for audio and video.  The OpenGl (Open Graphics Library) and SGL (Scalable Graphics Library) are the graphics libraries for 3D and 2D rendering, respectively.  The FreeType Library is used for rendering fonts.

3) Android Runtime

In android runtime, there are core libraries and DVM (Dalvik Virtual Machine) which is responsible to run android application. DVM is like JVM but it is optimized for mobile devices. It consumes less memory and provides fast performance. The Dalvik VM makes use of Linux core features like memory management and multi-threading, which is intrinsic in the Java language. The Dalvik VM enables every Android application to run in its own process, with its own instance of the Dalvik virtual machine.

4) Android Framework

On the top of Native libraries and android runtime, there is android framework. Android framework includes Android API's such as UI (User Interface), telephony, resources, locations, Content Providers (data) and package managers. It provides a lot of classes and interfaces for android application development.

  • Activity Manager : manages the life cycle of an applications and maintains the back stack as well so that the applications running on different processes has smooth navigations.
  • Package Manager : keeps track of which applications are installed in your device.
  • Window Manager : Manages windows which are java programming abstractions on top of lower level surfaces provided by surface manager.
  • Telephony Managers : manages the API which is use to build the phone applications

 Dalvik is a specialized virtual machine designed specifically for Android and optimized for battery-powered mobile devices with limited memory and CPU.  Android apps execute on Dalvik VM, a “clean-room” implementation of JVM  Dalvik optimized for efficient execution  Dalvik: register-based VM, unlike Oracle’s stack-based JVM  Java .class bytecode translated to Dalvik EXecutable (DEX) bytecode, which Dalvik interprets

7

  1. To launch Android Studio, navigate to the android-studio/bin/ directory in a terminal and execute studio.sh. You may want to add android-studio/bin/ to your PATH environmental variable so that you can start Android Studio from any directory.
  2. Follow the setup wizard to install any necessary SDK tools.

Android Studio is now ready and loaded with the Android developer tools, but there are still a couple packages you should add to make your Android SDK complete. 4)The SDK separates tools, platforms, and other components into packages you can download as needed using the Android SDK Manager. Make sure that you have downloaded all these packages. To start adding packages, launch the Android SDK Manager in one of the following ways:  In Android Studio, click SDK Manager in the toolbar.  If you're not using Android Studio: Windows: Double-click the SDK Manager.exe file at the root of the Android SDK directory. Mac/Linux: Open a terminal and navigate to the tools/ directory in the Android SDK, then execute android sdk. 5)Now get all the SDK tools, support libraries for additional APIs, Google Play services (if you need to use them ). 6)Once you've selected all the desired packages, continue to install: Click Install X packages. In the next window, double-click each package name on the left to accept the license agreement for each. Click Install. The download progress is shown at the bottom of the SDK Manager window. Do not exit the SDK Manager or it will cancel the download. 7)Now that we have downloaded and installed everything we need. Enjoy your experience with Android. Best of luck from Internshala.com

INSTALLING THE ANDRO ID SDK

For developing native Android applications that you can publish on the Google Play marketplace, you need to install the following four applications:

  • The Java Development Kit (JDK) can be downloaded from http://oracle.com/technetwork/java/javase/downloads/index.html.
  • The Eclipse IDE can be downloaded from http://www.eclipse.org/downloads/.
  • The Android Platform SDK Starter Package can be download from http://developer.android.com/sdk/index.html.
  • The Android Development Tools (ADT) Plug-in can be downloaded from http://developer.android.com/sdk/eclipse-adt.html. The plug-in contains project templates and Eclipse tools that help in creating and managing Android projects.

The Android SDK is not a full development environment and includes only the core SDK Tools, which are used to download the rest of the SDK components. This means that after installing the Android SDK Tools, you need to install Android platform tools and the other components required for developing Android applications. Go

8

to http://developer.android.com/sdk/index.html and download the package by selecting the link for your operating system.

The first screen is a Welcome screen. Select the Next button to move to the next screen. Because the Android SDK requires the Java SE Development Kit for its operation, it checks for the presence of JDK on your computer.

If Java is already installed on your computer before beginning with Android SDK installation, the wizard detects its presence and displays the version number of the JDK found on the machine, as shown in Figure.

Figure Dialog box informing you that the JDK is already installed on the computer

Select the Next button. You get a dialog box asking you to choose the users for which Android SDK is being installed. The following two options are displayed in the dialog box:

  • Install for anyone using this computer
  • Install just for me

Select the Install for anyone using this computer option and click Next. The next dialog prompts you for the location to install the Android SDK Tools, as shown in below Figure. The dialog also displays the default directory location for installing Android SDK Tools as C:\Program Files (x86)\Android\android-sdk, which you can change by selecting the Browse button. Keep the default directory for installing Android SDK Tools unchanged; then select the Next button to continue.

10

Figure: Successful installation of the Android SDK Tools dialog box

Note that the check box Start SDK Manager (to download system images) is checked by default. It means that after the Finish button is clicked, the Android SDK Manager, one of the tools in the Android SDK Tools package, will be launched. Android SDK is installed in two phases. The first phase is the installation of the SDK, which installs the Android SDK Tools, and the second phase is installation of the Android platforms and other components. An Android application is a combination of several small components that include Java files, XML resource and layout files, manifest files, and much more. It would be very time-consuming to create all these components manually. So, you can use the following applications to help you:

  • Eclipse IDE —An IDE that makes the task of creating Java applications easy. It provides a complete platform for developing Java applications with compiling, debugging, and testing support.
  • Android Development Tools (ADT) plug-in —A plug-in that’s added to the Eclipse IDE and automatically creates the necessary Android files so you can concentrate on the process of application development. Before you begin the installation of Eclipse IDE, first set the path of the JDK that you installed, as it will be required for compiling the applications. To set the JDK path on Windows, right-click on My Computer and select the Properties option. From the System Properties dialog box that appears, select the Advanced tab, followed by the Environment Variables button. A dialog box, Environment Variables, pops up. In the System variables section, double-click on the Path variable. Add the full path of the JDK (C:\Program Files\Java\jdk1.7.0_04\bin\java.exe) to the path variable and select OK to close the windows.

CREATING ANDROID VIRTUAL DEVICES

An Android Virtual Device (AVD) represents a device configuration. There are many Android devices, each with different configuration. To test whether the Android application is compatible with a set of Android devices, you can create AVDs that represent their configuration. For example, you can create an AVD that represents an Android device running version 4.1 of the SDK with a 64MB SD card. After creating AVDs, you point the emulator to each one when developing and testing the application. AVDs are the easiest way of testing the application with various configurations.

11

To create AVDs in Eclipse, select the Window, AVD Manager option. An Android Virtual Device Manager dialog opens, as shown in Figure. The dialog box displays a list of existing AVDs, letting you create new AVDs and manage existing AVDs. Because you haven’t yet defined an AVD, an empty list is displayed.

Figure: The AVD Manager dialog

Select the New button to define a new AVD. A Create new Android Virtual Device (AVD)dialog box, appears The fields are as follows:

  • Name—Used to specify the name of the AVD.
  • Target—Used to specify the target API level. Our application will be tested against the specified API level.
  • CPU/ABI—Determines the processor that we want to emulate on our device.
  • SD Card—Used for extending the storage capacity of the device. Large data files such as audio and video for which the built-in flash memory is insufficient are stored on the SD card.
  • Snapshot—Enable this option to avoid booting of the emulator and start it from the last saved snapshot. Hence, this option is used to start the Android emulator quickly.
  • Skin—Used for setting the screen size. Each built-in skin represents a specific screen size. You can try multiple skins to see if your application works across different devices.
  • Hardware—Used to set properties representing various optional hardware that may be present in the target device. In the AVD, set the Name of the AVD to demoAVD, choose Android 4.1—API Level 16 for the Target, set SD Card to 64 MiB, and leave the Default (WVGA800) for Skin. In the Hardware section, three properties are already set for you depending on the selected target. The Abstracted LCD density is set to 240; the Max VM application heap size is set to 48, and the Device RAM size is set to 512. You can select these properties and edit their values, delete them, and add new properties by selecting the New button. New properties can include Abstracted LCD density, DPad support, Accelerometer, Maximum horizontal camera pixels, Cache partition size, Audio playback support, and Track-ball support, among others.

Note You learn about the API and its different levels in Chapter 2, “Basic Widgets.” The new AVD, demoAVD, is created and displayed in the list of existing AVDs.

Note The larger the allocated SD Card space, the longer it takes to create the AVD. Unless it is really required, keep the SD Card space as low as possible. I would recommend keeping this small, like 64MiB.

13

Just click on the Add button as shown in the picture and add https://dl-ssl.google.com/android/eclipse/ as the location. When you press OK, Eclipse will start to search for the required plug-in and finally it will list the found plug- ins.

Step 3: Configuring the ADT plugin After the installing ADT plugin, now tell the eclipse IDE for your android SDK location. To do so:

  1. Select the Window menu > preferences
  2. Now select the android from the left panel. Here you may see a dialog box asking if you want to send the statistics to the google. Click proceed.
  3. Click on the browse button and locate your SDK directory e.g. my SDK location is C:\Program Files\Android\android-sdk.
  4. Click the apply button then OK.

14

Step 4: Create Android Virtual Device: The last step is to create Android Virtual Device, which you will use to test your Android applications. To do this, open Eclipse and Launch Android AVD Manager from options Window > AVD Manager and click on New which will create a successful Android Virtual Device. Use the screenshot below to enter the correct values.

USING THE TEXTVIEW CONTROL

In android ui or input controls are the interactive or View components which are used to design the user interface of an application. In android we have a wide variety of UI or input controls available, those are TextView, EditText, Buttons, Checkbox, Progressbar, Spinners, etc. In android, TextView is a user interface control which is used to set and display the text to the user based on our requirements. The TextView control will act as like label control and it won’t allow users to edit the text. A good example of TextView control usage would be to display textual labels for other controls, like "Enter a Date:", "Enter a Name:" or "Enter a Password:". In android, we can create a TextView control in two ways either in XML layout file or create it in Activity file programmatically. Specific attributes of TextView controls you will want to be aware of:  Give the TextView control a unique name using the id property.  Set the text displayed within the TextView control using the text property; programmatically set with the setText() method.  Set the layout height and layout width properties of the control as appropriate.  Set any other attributes you desire to adjust the control’s appearance. For example, adjust the text size, color, font or other style settings.  By default, text contents of a TextView control are left-aligned. However, you can position the text using the gravity attribute. This setting positions your text relative to the control’s overall width and height and only really makes sense to use if there is whitespace within the TextView control.  In XML, this property would appear within your TextView control as: android:gravity="center"

16

Limitations of the Android Emulator The Android emulator is useful to test Android applications for compatibility with devices of different configurations. But still, it is a piece of software and not an actual device and has several limitations:

  • Emulators no doubt help in knowing how an application may operate within a given environment, but they still don’t provide the actual environment to an application. For example, an actual device has memory, CPU, or other physical limitations that an emulator doesn’t reveal.
  • Emulators just simulate certain handset behavior. Features such as GPS, sensors, battery, power settings, and network connectivity can be easily simulated on a computer.
  • SMS messages are also simulated and do not use a real network.
  • Phone calls cannot be placed or received but are simulated.
  • No support for device-attached headphones is available.
  • Peripherals such as camera/video capture are not fully functional.
  • No USB or Bluetooth support is available. The emulator provides some facilities too. You can use the mouse and keyboard to interact with the emulator when it is running. For example, you can use your computer mouse to click, scroll, and drag items on the emulator. You can also use it to simulate finger touch on the soft keyboard or a physical emulator keyboard. You can use your computer keyboard to input text into UI controls and to execute specific emulator commands. Some of the most commonly used commands are
  • Back [ESC button]
  • Call [F3]
  • End [F4]
  • Volume Up [KEYPAD_PLUS, Ctrl-5]
  • Volume down [KEYPAD_MINUS, Ctrl-F6]
  • Switching orientations [KEYPAD_7, Ctrl-F11/KEYPAD_9, Ctrl-F12]

17

You can also interact with an emulator from within the DDMS tool. Eclipse IDE provides three perspectives to work with: Java perspective, Debug perspective, and DDMS perspective. The Java perspective is the default and the one with which you have been working up to now. You can switch between perspectives by choosing the appropriate icon in the top-right corner of the Eclipse environment. The three perspectives are as follows:

  • The Java perspective —It’s the default perspective in Eclipse where you spend most of the time. It shows the panes where you can write code and navigate around the project.
  • The Debug perspective —Enables application debugging. You can set breakpoints; step through the code; view LogCat logging information, threads, and so on.
  • The Dalvik Debug Monitor Service (DDMS) perspective —Enables you to monitor and manipulate emulator and device status. It also provides screen capture and simulates incoming phone calls, SMS sending, and GPS coordinates. To manage content in the device or emulator, you can use the ADB (Android Debug Bridge).

THE ANDROID DEBUG BRIDGE(ADB)

The Android-Debug-Bridge (abbreviated as adb) is a software-interface for the android system, which can be used to connect an android device with a computer using an USB cable or a wireless connection. It can be used to execute commands on the phone or transfer data between the device and the computer.[1]

The tool is part of the Android SDK (Android Software Development Kit) and is located in the subdirectory platform- tools. In previous versions of the SDK it was located in the subdirectory tools.

The Android Debug Bridge is a software interface between the device and the local computer, which allows the direct communication of both components. This includes the possibility to transfer files from one component to the other one, as well as executing commands from the computer on the connected device. The ADB can be used through a command line windows, terminal/shell in Linux-based systems, a command line (cmd) for Windows. The main advantage is to execute commands on the phone directly out of the computer, without any direct user interaction to the phone, which makes especially debugging a lot easier.

It is a client-server program that includes three components:

A client , which sends commands. The client runs on your development machine. You can invoke a client from a command-line terminal by issuing an adb command.  A daemon (adbd) , which runs commands on a device. The daemon runs as a background process on each device.  A server , which manages communication between the client and the daemon. The server runs as a background process on your development machine.

When you start an adb client, the client first checks whether there is an adb server process already running. If there isn't, it starts the server process. When the server starts, it binds to local TCP port 5037 and listens for commands sent from adb clients—all adb clients use port 5037 to communicate with the adb server. The server then sets up connections to all running devices. It locates emulators by scanning odd-numbered ports in the range 5555 to 5585, the range used by the first 16 emulators. Where the server finds an adb daemon (adbd),

19

1). idea: This folder contains the directories (subfolders) for IntelliJ IDEA settings.

  1. app: It contains the actual application code(source files, resource file and manifest files). It further contains the following sub-directories : a) bulid: This folder has sub-folders for the build-variants. The app/build/output/apk directory contains packages named app--<built-type>.apk. So different variant of the single app resides here. b) libs: As the name suggests, this folder has all the .jar files and the library files.

  2. src: Here you will see two sub-directories androidTest and main. In androidTest the application code for testing purpose is created by android automatically. This helps in building testing packages without modifying the building files and the application code.

main contains the all the source .java files including the stub mainactivity.java.

The res directory is where you will find the resources like drawable files, menu, values ( style files, string values, dimension values).

Sub-directories of res folder  anim/: For XML files that are compiled into animation objects.  color/: For XML files that describe colors.

20

 drawable/:For image files (PNG, JPEG, or GIF), 9-Patch image files, and XML files that describe Drawable shapes or Drawable objects that contain multiple states (normal, pressed, or focused).  mipmap/: For app launcher icons. This folder contains additional sub-folders for different screen resolutions. Once an image is imported into this folder, Studio automatically resizes the image into different resolutions and places them in the appropirate folders. This behavior allows launcher apps to pick the best resolution icon for your app to display on the home screen. To see how to import an image into the mipmap folder, please read about using 'Image asset'.  layout/: XML files that are compiled into screen layouts (or parts of a parent layout).  menu/: For XML files that define application menus.  values/: For XML files that define constants that can be accessed in other XML and Java files.

R.java

R.java is an uneditable file auto-generated by Studio, whenever we modify the XML content. This file links the XML values to Java files. Whenever we need to use XML values in a Java file, we call these values using the R class. The following images show a sample XML file, where a string variable named 'title' is assigned a value of 'Internshala - Tic Tac Toe'. This variable is then accessed in a java file using the R class.

  1. Gradle scripts: With Android studio, Google switched to the new advanced building system, Gradle. It is a JVM based build system. If you want to make the package building task automatically, then you can write your own script in java or groovy and distribute it. Gradle allows to create different variants apk files for the same application project. We will learn about Gradles in the later chapters.
  2. External Libraries: This is the place where all the referenced libraries and the information about the targeted platform SDK are stored.

What is Build system and Gradle

The build system is responsible to build, test an android system and also prepare the deployable files for the specified platform. In simple words, build system generates the .apk files for the application project.

With Android Studio, the advanced build system allows the developers to configure the build systems manually, create different variant APK files from single project (without modifying the execution code) and share the code and resources from other modules. Before Android Studio, Eclipse was the IDE used for android development. Eclipse kept all the .java files (in src directory) and resource files (in res directory) in the same directory. That allows the build system to group all the files into an intermediate code and finally generates .apk file. Android Studio uses Gradle as its build system. One intriguing feature that Gradle offers is that it allows you to write your own script to automate the task of building an app. As Gradle is plug-in based system, if you have your own programming language then you can write the plug-in in the script using java or groovy and share it with other developers too. Isn`t that cool?