Android opensource: eclipse for source code development

Source: Internet
Author: User

I. Version description:

1. eclipse for javaee 3.5.2

2. jdk1.6

3. adt12.0

4. Linux/ubuntu10.04 or Linux/ubuntu10.10

Ii. preparations:

1. Download android2.3.7 source code

Blog http://blog.csdn.net/androidbluetooth/article/details/6538254 explains how to download android2.3.7 source code, for details can refer to the android official website.

2. Compile the source code

You must compile the source code. Otherwise, many problems may occur. Remember: If the download is okay, compilation is only a matter of time.

Http://www.cnitblog.com/houcy/archive/2011/02/10/72771.html is very thorough, you can try.

If your machine has good performance, the compilation will be completed in about an hour. Wait for the compilation to take a long time!

Note: After compilation is successful, the out directory is the crystallization.

3. Configuration File

Assume that the downloaded Android source code (root directory) is located:

/home/mark/android_src

Then, CD to this directory:

cd /android_src/development/ide/eclipse

Run the following command to view the file:

ls -al

You can find that there are three files (including hidden files. classpath)

 android-formatting.xml android.importorder .classpath

Next, copy. classpath to the source code root directory.

cd /home/mark/android_src/development/ide/eclipsecp .classpath /home/mark/android_src/

If you do not like the command line, you can operate it in a graphical interface. in Linux, The. xxx file is a hidden file. You can select View/show hidden files in Ubuntu resource manager, so that the hidden files will pop up, and you can ctrl c and ctrl v (CV warrior ).

OK. Open your eclipse and follow the policy in two steps.

1. Import android-formatting.xml in window-> preferences-> JAVA-> code style-> formatter

2. Import Android. importorder in WINDOW> preferences> JAVA> code style> organize imports.


4. Modify. classpath


Open this file and you will see a bunch of dense files, but it will be clear if you look at the classification. It is nothing more than specifying some paths.

Many online buddies have said that if you do not modify the classpath, it will destroy the source code (of course, if you just look at the source code, it doesn't matter if you do not modify it), so if you do source code development, modify it as appropriate. After all, it takes 10 minutes.


So, how to modify Ni? You need bright eyes and patience!


1. delete a path that does not exist in the android source code in. classpath.


If the tag does not exist, delete the entire tag.

At the end of the file, you will see a label similar to <classpathentry kind = "lib" ××××/>. Note that you need to delete the label.


2. Add appropriate


If you want to modify the application-layer development, you certainly want to have all the code under packages/apps/, but some of the classpath does not, then you should manually add it.

Add gallery3d as an example.

<classpathentry kind="src" path="packages/apps/Gallery3D/src"/>

Note: Do not add gallery3d again after adding gallery3d (repeated classes), or add only gallery without adding gallery3d. Otherwise, an error is reported.

If your classpath does not include:

<classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/android-common_intermediates/javalib.jar"/>

You can add them manually!


5. Modify the eclipse configuration file


In the eclipse root directory, there is a configuration file: Eclipse. ini. Find and open it.

-XX:MaxPermSize=256m-Xms128m-Xmx512m

You want to add or modify the same configuration as the preceding three in your configuration file.


6. Import Source Code


1. Create a Java project in eclipse, not an android project.


2. Select Create project from existing source and specify/home/mark/android_src.


3. Wait for the import and let the time prove everything. You can take a rest at this time. Stretch down, huh, huh!

Certificate ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

If there is still an error when importing eclipse, it may be because you have not followed the above patience, or the. classpath modification is incorrect.


By the way:If you work in Windows, you can use the sharing function to import the compiled source code in Linux to Windows, and then use eclipse for development in windows.The specific steps are similar to the above and will not be repeated.


Okay. What's the problem? Please check it out!



*

@@

&

###






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.