Android development environment build under Linux (2)

Source: Internet
Author: User
Tags android sdk manager

First, the installation configuration of the JDK

Create a new folder under the Personal home folder software, under software New Java folder, for storing various Android development programs, my user name AAA, so the full directory is/home/aaa/software/java

Then copy the jdk-7-linux-x64.gz to the/home/aaa/software/java/directory, right-click Unzip, the Jdk-7-linux-x64 file will appear, right-click again to extract the jdk1.7.0 folder, 1-1:

Figure 1-1

Next configure the development environment, use the command sudo gedit/etc/environment, 1-2, add the following three lines of code, note the AAA in the code, to change to its own user name, 1-3:

Export java_home=/home/aaa/software/java/jdk1.7.0

Export JRE_HOME=/HOME/AAA/SOFTWARE/JAVA/JDK1.7.0/JRE

Exportclasspath=.: $CLASSPATH: $JAVA _home/lib: $JAVA _home/jre/lib

Figure 1-2

Figure 1-3

Edit the profile file, Sudogedit/etc/profile, add the following four lines of code, note the AAA in the code, to change to its own user name, 1-4

exportjava_home=/home/aaa/software/java/jdk1.7.0

Exportjre_home=/home/aaa/software/java/jre

Exportclasspath=.: $CLASSPATH: $JAVA _home/lib: $JAVA _home/jre/lib

Exportpath= $JAVA _home/bin: $JAVA _home/jre/bin: $PATH: $HOME/bin

Figure 1-4

Log off the user, log back in, enter the terminal input java-version, if the figure 1-5 appears, the installation was successful.

Figure 1-5

Ii. installation of Eclipse

Unzip eclipse-sdk-4.2-linux-gtk-x86_64.tar.gz under Java file, 2-1, right-click Eclipse File, create link, copy the created link to the desktop, and then double-click the link to open eclipse.

Figure 2-1

Figure 2-2

Third, the installation of the SDK

Because the SDK is a 32-bit program, if you are installing on a 64-bit system, install the Ia32-libs library file first. The command to install the Ia32-libs library file via terminal is as follows:

sudo apt-get install Ia32-libs

The interface shown in Figure 3-1 will appear during execution, enter Y, and wait for the installation to finish.

Figure 3-1

Unzip the android-sdk_r20.0.3-linux.tgz under the Java file, 3-2:

Figure 3-2

Iv. installing the ADT plug-in in eclipse

ADT Plug-ins are installed in two ways, one for online installation and two for offline installation. It is recommended to install the ADT plug-in online, before installing online, you need to set the Google server address, using the command:

sudo gedit/etc/hosts

Open the Hosts file and add code at the end of the file:

74.125.237.1 dl-ssl.google.com

Save exit, 4-1; if not set up here, the failed to fetch URL http://dl-ssl.google.com/will appear on the online installation and the installation package error cannot be downloaded.

Figure 4-1

Double-click to open Eclipse, you will be prompted to set the workspace location, 4-2, according to individual needs set up after

Figure 4-2

Click on Help--->installnew software,4-3, the figure 4-4 interface will appear

Figure 4-3

Figure 4-4

Click Add next to the input box after work with the figure 4-5 interface,

Figure 4-5

After name enter: Adtplugin (can be arbitrarily named), name can be entered at will, enter after location: https://dl-ssl.google.com/android/eclipse/, click Ok,4-6.

Figure 4-6

As shown in Figure 4-7, Developertools is the plug-in package we need, Ndkplugins is a toolkit for Android/C + + developed by Google, with the option to install, Developertools, NDK Plugins all tick, click Next, appears in Figure 4-8 interface, click Next, appear in Figure 4-9 interface, select Iaccept, click Next, appear in Figure 4-10 interface, the installation process will appear in Figure 4-11, click OK, After installation, you will see the hint of Figure 4-12, click OK.

Figure 4-7

Figure 4-8

Figure 4-9

Figure 4-10

Figure 4-11

Figure 4-12

Five, Android SDK Manager

After installing ADT, reboot into Eclipse, appear welcome to Android development interface, 5-1, after this interface, click Cancel or close directly;

Figure 5-1

Go to the figure 5-2 interface:

Figure 5-2

Click Window-> perferences, set the location of ANDROID-SDK, 5-3:

Figure 5-3

appear in Figure 5-4 interface, left column select Android, right sdklocation select Android-sdk-linux Choose Location, click OK.

Figure 5-4

Click window-> Android SDK manager,5-5:

Figure 5-5

Pop up Figure 5-6 interface, select Android SDK platfrom-tools and Android2.3.3 (API10), click Install.

Figure 5-6

The figure 5-7 interface appears, select AcceptAll, and click Install.

Figure 5-7

After installation, and then into the Android SDK manager interface, 5-8 can find that the required installation package has been installed, if not installed, you can select and install again.

Figure 5-8

Enter the Android-sdk-linux folder, 5-9, you can find more platform-tools, temp, samples folder, where Platform-tools is we through the Android SDK The Manager downloads Android SDK Platform-tools, which includes tools such as ADB, while Samples contains the Android 2.3.3 Samples for ADK we need, Next we will do some simple demo development based on this samples.

Figure 5-9

Vi. compilation and installation of API demos programs

Click File->new->project,6-1 as shown:

Figure 6-1

The Figure 6-2 screen appears, select Android Sampleproject, and click Next.

Figure 6-2

The Figure 6-3 screen appears, select Android 2.3.3, and click Next.

Figure 6-3

The figure 6-4 interface appears, select Apidemos, and click Finsh.

Figure 6-4

The figure 6-5 interface appears:

Figure 6-5

Using USB to connect your Android phone to your PC, confirm that your phone is enabled for USB debug mode, and then click Run->run,6-6 as shown:

Figure 6-6

If it goes well, you can see the mobile phone has entered the API Demos program interface.

If the phone fails to enter the program interface, the ADB fails to connect to the phone. You can open the terminal, enter the Platform-tools folder under the Android-sdk-linux installation directory, the specific command for CD Software/java/android-sdk-linux/platform-tools, execute. Adbdevices command, if you can see the specific device, then the computer has been connected to the phone via ADB. 6-7 is shown below:

Figure 6-7

If the ADB does not recognize devices due to multiple plug and unplug of the USB cable, a prompt for list ofdevices attached appears, 6-8, then execute the command in turn:

./adb Kill-server

./ADB Devices

List ofdevices will still be prompted after attached,6-9

You can then reseat the phone and re-execute it./ADB devices, there will be???????????? Device tips, 6-10 then execute the command in turn:

./adb Kill-server

./ADB Devices

After the general can identify the device, 6-11

List of devices attached

Figure 6-8

Figure 6-9

Figure 6-10

Figure 6-11

If you execute./adbdevices the prompt that appears is

List of devices attached

???????????? No permissions,

This prompt is usually caused by the replacement of the phone, you can sequentially execute the command:

./adb Kill-server

sudo./adb root

./ADB Devices

At this point, the phone is generally recognized, 6-12

Figure 6-12

Vii. compilation and installation of USB Accessorydemo

Copy usbaccessory demo.zip to workspace, right-click to extract, 7-1:

Figure 7-1

In Eclipse, click File>import,7-2:

Figure 7-2

The figure 7-3 interface appears, select Existingprojects into Workspace, click Next;

Figure 7-3

appear in Figure 7-4 interface, click Browse;

Figure 7-4

appear in Figure 7-5 interface, enter basicaccessory Demo folder, click OK;

Figure 7-5

The figure 7-6 interface appears, click Finsh.

Figure 7-6

In the figure 7-7 interface, click run>run,7-8;

Figure 7-7

Figure 7-8

The interface shown in Figure 7-9 appears, click OK, this is the mobile phone will appear basicaccessory demo program interface, 7-10;

Figure 7-9

Figure 7-10

If you are using a phone with no USB accessory, there will be installationerror:install_failed_missing_shared_library error, 7-11,7-12 need to modify the kernel at this time, No introduction in this tutorial.

Figure 7-11

Figure 7-12

At this point the Android development environment has been completed, access to the USB accessory Demo-pic Program ZC-ADK Development Board can be.

Viii. compilation and installation of BlueTooth Accessorydemo

Compile and install the same method as the USB Accessorydemo, access to burn the Bluetooth accessory demo-pic Program ZC-ADK Development Board can be.

Android development Environment under Linux build (2)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.