Detailed tutorial on setting up the android development environment in Ubuntu

Source: Internet
Author: User

1. First you need to download JDK for installation and configuration, laruence Skip,: http://www.oracle.com/technetwork/java/javase/downloads/index.html

The downloaded file is a file suffixed with bin. At this time, UBUNTU does not have the permission to run the file. You can run the command: sudo chmod A + x *** in its directory ***. bin. /***. bin to decompress the file. After decompression, you also need to configure the JDK environment variable. you can add the following command at the end of the/etc/profile file: java_home =/home/Welen/jdk1.6.0 _ 32 # This is the JDK decompressed directory java_home =/home/Welen/jdk1.6.0 _ 32 # This is my JDK file storage path, not yours, you need to modify android_home =/home/Welen/Android-SDK-Linux # This is the SDK Path = $ java_home/bin: $ android_home/platform-tools: $ pathclasspath =.: $ java_home/lib/DT. jar: $ java_home/lib/tools. after jarexport java_homeexport pathexport classpath is completed, restart and execute Java-version in the terminal. The previous JDK version indicates that the configuration is successful.

* ** If it conflicts with openjava, run the following commands:

Sudo Update-alternatives -- install/usr/bin/Java/usr/bin/JVM/Java/jdk1.6.0 _ 32/bin/Java 300

Sudo Update-alternatives -- install/usr/bin/javac/usr/bin/JVM/Java/jdk1.6.0 _ 32/bin/javac 300

Enter sudo Update-alternatives -- config Java and select the corresponding JDK

Enter Java-version to check whether it is Sun's JDK. So far, sun-JDK has been successfully installed.

2. after installing the JDK runtime environment for Eclipse, you will start to install Elipse. Elipse is nothing to say, which can be downloaded as follows: http://www.eclipse.org/downloads/the downloaded file can be decompressed to run (provided that the JDK runtime environment has been configured before ). 3. the following are necessary Android development plug-ins such as ADT and SDK download and installation of ADT and SDK can be downloaded at the following URL: New softwave, in the pop-up window, select the Add button to add the downloaded ADT file, select all and select next (before that, you can choose to cancel the last check box, this is an online check download support. Unless the installation fails after cancellation, it is generally selected because the wait time is too long.) After accepting the terms and finishing, you can wait for the installation to complete, restart Elipse. After Elipse is restarted, a dialog box will pop up asking you to select the SDK and select the second option. The SDK already exists in the local machine. The directory points to the downloaded SDK directory and click Finish. This will bring up the SDK.
On the Manager page, select the installed SDK platform support plug-in .. The download may take a long time and wait patiently. This is basically done. 4. the following is the installation method of SVN plug-in under Elipse, such as ADT, but here we do not select a local file, but enter the following URL in the address bar: http://subclipse.tigris.org/update_1.8.x, you can obtain SVN from the network for installation. The method is as above and is not described in detail. After installation, you may encounter an error: an error occurs when javahl is used as the connector after subclipse is installed in eclipse in Ubuntu:

Failed to load JavaHL Library.These are the errors that were encountered:no libsvnjavahl-1 in java.library.pathno svnjavahl-1 in java.library.pathno svnjavahl in java.library.pathjava.library.path = /usr/lib/jvm/java-6-sun-1.6.0.20/jre/lib/i386/client:/usr/lib/jvm/java-6-sun-1.6.0.20/jre/lib/i386:/usr/lib/xulrunner-addons:/usr/lib/xulrunner-addons:/usr/java/packages/lib/i386:/lib:/usr/lib

 

This is because eclipse cannot find javahl. solution:

1. Install javahl

Sudo apt-Get install libsvn-Java

2. Edit eclipse. ini

Add the following Under-vmargs:

-Djava. library. path =/usr/lib/JNI # The so file may no longer be in the JNI directory, and the JNI directory may not be found, it may be in the/usr/lib/i386-linux-gnu/JNI directory, I found it in this directory and changed it to the corresponding directory.

 

Final:

Through the above steps, the Elipse Android development environment under Ubuntu can be said to be successful, but at this time you may find that it is okay to use the simulator for testing, but it cannot identify the real machine, the solution is as follows:

 

1. Run lsusb on the terminal

The following similar records will be found in the results:

Bus 001 device 008: Id 0bb4: 0c02 high tech Computer Corp.

Enter

Sudo gedit/etc/udev/rules. d/51-android.rules

Add the following text to the open file:

Subsystem = "USB", sysfs {"high tech Computer Corp." }== "0bb4", mode = "0666"

2. Run the following command:

Sudo chmod A + Rx/etc/udev/rules. d/51-android.rules sudo/etc/init. d/udev restart

3. Run the tool in the platform-tools directory of the android SDK (add the directory of platform-tools and tools to the path in advance)

Sudo./ADB kill-Server

Sudo./ADB Devices

For more information, see Dev guide-developing-using hardwave devices in the androidsdk documentation. The IDS of specific models are also listed.

At this point, there is really nothing to stop you from developing. Congratulations...

 

And so on .. It may be that you have started to run ecllipse to write code, but you will find that the background color of the pop-up box is black, and it is ugly, elegant, you should not allow such a problem to occur, so we need to solve it. This problem is mainly because eclipse uses the color solution provided by the system. Therefore, if you are using a version earlier than 11.04, you can change the corresponding settings in the appearance. The problem is that if it is 11.04 or later, the corresponding settings cannot be found in the appearance, in this case, you need to change the system configuration file as follows:

 

Solution with a black background color in the eclipse prompt box under ubuntu11.10

The background color of the eclipse prompt box in Ubuntu is black and looks uncomfortable. This is because eclipse uses the system subject by default. Versions earlier than ubuntu11.10 can be changed through system Settings> appearance> modify the custom color of the topic. However, in ubuntu11.10, the interface for directly modifying the topic is no longer provided, but the file can only be modified:/usr/share/themes/ambiance/gtk-2.0/gtkrc

First, modify the read-only permission, and then open the edit. The following four attributes of the first line are the parts to be modified:

Selected_fg_color: select the foreground color

Tooltip_fg_color: foreground color (#000000)

Selected_bg_color: select the background color

Tooltip_bg_color: background color of the prompt box (# f2edbc)

Here, I have nothing to pick up. Let's do it .............

Related Article

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.