Advertisement

LightBlog
Responsive Ads Here
Mostrando postagens com marcador android. Mostrar todas as postagens
Mostrando postagens com marcador android. Mostrar todas as postagens

quarta-feira, 23 de agosto de 2017

Building Your First AppWelcome to Android application development!

This class teaches you how to build your first Android app. You’ll learn how to create an Android project with Android Studio and run a debuggable version of the app. You'll also learn some fundamentals of Android app design, including how to build a simple user interface and handle user input.
Before you start this class, download and install Android Studio.

Run Your App

This lesson teaches you to

  1. Run on a real device
  2. Run on an emulator
In the previous lesson, you created an Android project that displays "Hello World." You can now run the app on a real device or an emulator.

Run on a real device


Set up your device as follows:
  1. Connect your device to your development machine with a USB cable. If you're developing on Windows, you might need to install the appropriate USB driver for your device. For help installing drivers, see the OEM USB Drivers document.
  2. Enable USB debugging on your device by going to Settings > Developer options.
    Note: On Android 4.2 and newer, Developer options is hidden by default. To make it available, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options.
Run the app from Android Studio as follows:
  1. In Android Studio, click the app module in the Project window and then select Run > Run (or click Run  in the toolbar).
  2. In the Select Deployment Target window, select your device, and click OK.
Android Studio installs the app on your connected device and starts it.
That's "hello world" running on your device! To start developing, continue to the next lesson.

Run on an emulator


Before you run your app on an emulator, you need to create an Android Virtual Device (AVD) definition. An AVD definition specifies the characteristics of an Android phone, tablet, Android Wear, or Android TV device that you want to simulate in the Android Emulator.
Create an AVD Definition as follows:
  1. Launch the Android Virtual Device Manager by selecting Tools > Android > AVD Manager, or by clicking the AVD Manager icon  in the toolbar.
  2. In the Your Virtual Devices screen, click Create Virtual Device.
  3. In the Select Hardware screen, select a phone device, such as Pixel, and then click Next.
  4. In the System Image screen, click Download for one of the recommended system images. Agree to the terms to complete the download.
  5. After the download is complete, select the system image from the list and click Next.
  6. On the next screen, leave all the configuration settings as they are and click Finish.
  7. Back in the Your Virtual Devices screen, select the device you just created and click Launch this AVD in the emulator .
While the emulator starts up, close the Android Virtual Device Manager window and return to your project so you can run the app:
  1. Once the emulator is booted up, click the app module in the Project window and then select Run > Run (or click Run  in the toolbar).
  2. In the Select Deployment Target window, select the emulator and click OK.
Android Studio installs the app on the emulator and starts it.
That's "hello world" running on the emulator! To start developing, continue to the next lesson.
Environment
You will be glad to know that you can start your Android application development on either of the following operating systems −
  • Microsoft Windows XP or later version.
  • Mac OS X 10.5.8 or later version with Intel chip.
  • Linux including GNU C Library 2.7 or later.
Second point is that all the required tools to develop Android applications are freely available and can be downloaded from the Web. Following is the list of software's you will need before you start your Android application programming.
  • Java JDK5 or later version
  • Android Studio
Here last two components are optional and if you are working on Windows machine then these components make your life easy while doing Java based application development. So let us have a look how to proceed to set required environment.

Set-up Java Development Kit (JDK)

You can download the latest version of Java JDK from Oracle's Java site − Java SE Downloads. You will find instructions for installing JDK in downloaded files, follow the given instructions to install and configure the setup. Finally set PATH and JAVA_HOME environment variables to refer to the directory that contains java and javac, typically java_install_dir/bin and java_install_dir respectively.
If you are running Windows and installed the JDK in C:\jdk1.8.0_102, you would have to put the following line in your C:\autoexec.bat file.
set PATH=C:\jdk1.8.0_102\bin;%PATH%
set JAVA_HOME=C:\jdk1.8.0_102
Alternatively, you could also right-click on My Computer, select Properties, then Advanced, then Environment Variables. Then, you would update the PATH value and press the OK button.
On Linux, if the SDK is installed in /usr/local/jdk1.8.0_102 and you use the C shell, you would put the following code into your .cshrc file.
setenv PATH /usr/local/jdk1.8.0_102/bin:$PATH
setenv JAVA_HOME /usr/local/jdk1.8.0_102
Alternatively, if you use Android studio, then it will know automatically where you have installed your Java.

Android IDEs

There are so many sophisticated Technologies are available to develop android applications, the familiar technologies, which are predominantly using tools as follows