Difference between revisions of "IoTGateway/BSP/Android/ApplicationDevelopGuide"

From ESS-WIKI
Jump to: navigation, search
Line 27: Line 27:
 
=== Introduction ===
 
=== Introduction ===
  
This document describes how to build Android Application development environment(Android Studio & Eclipse) for Windows. Android Studio is the official Integrated Development Environment(IDE) for Android app development, based on&nbsp;IntelliJ IDEA . For an introduction to Android Studio, please visit the websit&nbsp;<u>[https://developer.android.com/studio/intro/index.html https://developer.android.com/studio/index.html]</u>.&nbsp;
+
This document describes how to build Android Application development environment(Android Studio v2.2.3) for Windows. Android Studio is the official Integrated Development Environment(IDE) for Android app development, based on&nbsp;IntelliJ IDEA . For an introduction to Android Studio, please visit the websit&nbsp;<u>[https://developer.android.com/studio/intro/index.html https://developer.android.com/studio/index.html]</u>.&nbsp;
  
 
=== To install JDK ===
 
=== To install JDK ===
Line 43: Line 43:
 
2 - Choose components.
 
2 - Choose components.
  
[[File:Build env 2.png]]
+
[[File:Build env 2.png|RTENOTITLE]]
  
 
3 - Agree with the license.
 
3 - Agree with the license.
  
[[File:Build env 3.png]]
+
[[File:Build env 3.png|RTENOTITLE]]
  
 
4 - Set installation location.
 
4 - Set installation location.
  
[[File:Build env 4.png]]
+
[[File:Build env 4.png|RTENOTITLE]]
  
 
5 - Choose start menu folder.
 
5 - Choose start menu folder.
  
[[File:Build env 5.png]]
+
[[File:Build env 5.png|RTENOTITLE]]
  
 
6 - Installing Android Studio.
 
6 - Installing Android Studio.
  
[[File:Build env 6.png]]
+
[[File:Build env 6.png|RTENOTITLE]]
  
 
7 - Install finushed.
 
7 - Install finushed.
  
[[File:Build env 7.png]]
+
[[File:Build env 7.png|RTENOTITLE]]
  
 
Then, Refer to&nbsp;the following step to&nbsp;install Android SDK (You might see these pictures(8~14) when you use Android Studio for the first time. If you have no idea how to do, Just ignore them and always choose the next step.):
 
Then, Refer to&nbsp;the following step to&nbsp;install Android SDK (You might see these pictures(8~14) when you use Android Studio for the first time. If you have no idea how to do, Just ignore them and always choose the next step.):
Line 69: Line 69:
 
8 - Import settings from a previous version of studio.
 
8 - Import settings from a previous version of studio.
  
[[File:Build env 8.png]]
+
[[File:Build env 8.png|RTENOTITLE]]
  
 
9 - Click Cancel to continue.
 
9 - Click Cancel to continue.
  
[[File:Build env 9.png]]
+
[[File:Build env 9.png|RTENOTITLE]]
  
 
10 - Click Next to continue.
 
10 - Click Next to continue.
  
[[File:Build env 10.png]]
+
[[File:Build env 10.png|RTENOTITLE]]
  
 
11 - Choose the setup type.
 
11 - Choose the setup type.
  
[[File:Build env 11.png]]
+
[[File:Build env 11.png|RTENOTITLE]]
  
 
12 - Check the Android SDK components you want to install.
 
12 - Check the Android SDK components you want to install.
  
[[File:Build env 12.png]]
+
[[File:Build env 12.png|RTENOTITLE]]
  
 
13 - Verify settings and start SDK install.
 
13 - Verify settings and start SDK install.
  
[[File:Build env 13.png]]
+
[[File:Build env 13.png|RTENOTITLE]]
  
 
14 - Installing Android SDK.
 
14 - Installing Android SDK.
  
[[File:Build env 14.png]]
+
[[File:Build env 14.png|RTENOTITLE]]
  
 
15&nbsp;- Finished install.
 
15&nbsp;- Finished install.
  
[[File:Build env 15.png]]
+
[[File:Build env 15.png|RTENOTITLE]]
  
 
For get more information about Android Studio, please visit the official user guide [https://developer.android.com/studio/intro/index.html <u>https://developer.android.com/studio/intro/index.html</u>].
 
For get more information about Android Studio, please visit the official user guide [https://developer.android.com/studio/intro/index.html <u>https://developer.android.com/studio/intro/index.html</u>].

Revision as of 09:03, 6 February 2017

preparations

Please download "jdk-8u121-windows-x64.exe" from http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html.

Launch the .exe file you downloaded . Follow the setup wizard to install JDK .

Then refer to the following step to open system variables window:

Computer -> Properties -> Advanced system settings -> Advanced -> envionment variables.

RTENOTITLE

Create a new system variable JAVA_HOME. The variable value is the location where JDK installed, such as: D:\Program Files\Java\jdk1.8.0_121

RTENOTITLE

Create a new system variable CLASS_PATH. The variable value is: .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar;

RTENOTITLE

Edit system variable PATH. Add: %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;

RTENOTITLE

Build Android Studio development environment

Introduction

This document describes how to build Android Application development environment(Android Studio v2.2.3) for Windows. Android Studio is the official Integrated Development Environment(IDE) for Android app development, based on IntelliJ IDEA . For an introduction to Android Studio, please visit the websit https://developer.android.com/studio/index.html

To install JDK

Please refer to Chapter 1.1 "To install JDK".

To install Android Studio

Please download "android-studio-bundle-145.3276617-windows.exe" from https://developer.android.com/studio/index.html. Launch the .exe file you downloaded. Follow the setup wizard to install Android Studio and any necessary SDK tools. The following pictures shows each step of the recommended setup procedure:

1 - Click Next to start setup.

RTENOTITLE

2 - Choose components.

RTENOTITLE

3 - Agree with the license.

RTENOTITLE

4 - Set installation location.

RTENOTITLE

5 - Choose start menu folder.

RTENOTITLE

6 - Installing Android Studio.

RTENOTITLE

7 - Install finushed.

RTENOTITLE

Then, Refer to the following step to install Android SDK (You might see these pictures(8~14) when you use Android Studio for the first time. If you have no idea how to do, Just ignore them and always choose the next step.):

8 - Import settings from a previous version of studio.

RTENOTITLE

9 - Click Cancel to continue.

RTENOTITLE

10 - Click Next to continue.

RTENOTITLE

11 - Choose the setup type.

RTENOTITLE

12 - Check the Android SDK components you want to install.

RTENOTITLE

13 - Verify settings and start SDK install.

RTENOTITLE

14 - Installing Android SDK.

RTENOTITLE

15 - Finished install.

RTENOTITLE

For get more information about Android Studio, please visit the official user guide https://developer.android.com/studio/intro/index.html.

Build Eclipse development environment

Install Eclipse

Please download "eclipse-jee-juno-SR2-win32-x86_64.zip" from

http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/juno/SR2/eclipse-jee-juno-SR2-win32-x86_64.zip

After the download is complete, unzip directly to the desired directory, double-click the eclipse icon to use, without additional installation process.

Install Android ADT Plug-in

Follow the setup wizard to install Android ADT plug-in .

The following pictures shows each step of the recommended setup procedure:

  1. Open eclipse->help->install new software
    Adt1.jpg
  2. Click Add to Add Repository
    Name:Android
    Location:https://dl-ssl.google.com/android/eclipse
    Adt2.jpg
  3. Choose Developer Tools.
    Adt3.jpg
  4. Click Next.
    Adt4.jpg
  5. Agree with the license.
    Adt5.jpg
  6. Installing ADT plug-in.
    Adt6.jpg
  7. Install finished and Restart Eclipse.
    Adt7.jpg

Install SDK

Please download " installer_r24.1.2-windows.exe " from https://dl.google.com/android/installer_r24.1.2-windows.exe. Launch the .exe file you downloaded . Follow the setup wizard to install necessary SDK tools.

The following pictures shows each step of the recommended setup procedure:

  1. Click Next to start setup.
    RTENOTITLE
  2. Choose Users.
    RTENOTITLE
  3. Set installation location.
    RTENOTITLE
  4. Installing Android SDK Tool.
  5. Install SDK Tool finushed.
    RTENOTITLE
  6. Open SDK Manager.
    RTENOTITLE
    RTENOTITLE
  7. Choose the necessary components,Then click Install to installing SDK components.
    RTENOTITLE
  8. Install finushed.
    RTENOTITLE
    Sdk9.jpg
  9. Open eclipse->Window->preferences.
    RTENOTITLE
  10. Click Android and Browse to Set SDK Location.
    SDK Location: Fill in the path of your SDK installation
    RTENOTITLE

ADB Tool

ADB Environment Configuartion

Add platform-tools path

Computer -> Properties -> Advanced system settings -> Advanced -> enviornment variables

Edit System Variable path. Add The variable value is the location where SDK installed, Such as:

D:\eclipse-jee-juno-SR2-win32-x86_64\android-sdk\platform-tools;
RTENOTITLE

  1. Restart the computer.
  2. Verification.
    Open cmd.exe and Execute the adb command.
    Adb2.jpg

How to use Android ADB

ADB debugging needs to ensure that the device is in developer mode

Use otg to connect.

  1. View the device
    Adb3.jpg
  2. Enter the shell terminal and execute the shell command
    Adb4.jpg
  3. Exit the shell command
    Adb5.jpg

Use the LAN to connect.

  1. Restart devices service
    Network debugging must ensure that debugging machine and equipment in the same local area network. First use the otg link device to execute the following command and then disconnect the otg link.
  2. connect devices
  3. Enter the shell terminal and execute the shell command
  4. Exit the shell command
  5. Disconnect the link

For get more information about ADB, please visit the official user guide http://adbshell.com/.