Introduction to Android using Eclipse as a way to develop source code _android

Source: Internet
Author: User

This article is an example of how Android started using Eclipse for source code development. Share to everyone for your reference, specific as follows:

First, version description :

1. Eclipse for Java EE 3.5.2

2. jdk1.6

3. adt12.0

4. linux/ubuntu10.04 or linux/ubuntu10.10

Second, the preparatory work :

1. Download Android2.3.7 Source

For details, refer to the Android website.

2. Compile the source code

Source code must be compiled, or it will cause a lot of problems. Remember: If the download is okay, compiling is just a matter of time.

If your machine performance is better, one hours or so compile will be completed, waiting to compile it, long!

Note: After the compilation succeeds, the out directory is its crystallization.

Third, the configuration file:

This assumes that the download of the Android source (root directory) is located at:

/home/mark/android_src

Then, CD to this directory:

Cd/android_src/development/ide/eclipse 

Execute the following command to view the file:

Ls-al 

As you can see, there are three files (including hidden files. Classpath)

①android-formatting.xml
②android.importorder
③.classpath

Next, copy the. Classpath to the source root directory.

Cd/home/mark/android_src/development/ide/eclipse 
CP. classpath/home/mark/android_src/ 

If you don't like the command line, you can manipulate the graphics interface, under Linux. xxxxx files are hidden files. You can choose View/show Hidden files in the Ubuntu Explorer so that the hidden files will surface and you can ctrl C, CTRL V (CV Warrior).
OK, open your eclipse, two-step strategy.

1. Import Android-formatting.xml in Window->preferences->java->code Style->formatter

2. Import Android.importorder in Window->preferences->java->code style->organize imports

Iv. modification. Classpath

Open this file, you can see a lot of, but if you classify it is very clear, nothing more than the designation of some paths.

Many friends on the Internet, if you do not modify this classpath, will destroy the source code (of course, you just look at the source words, modify do not modify that does not matter), so do the source code development, or appropriate to modify it, after all, 10 minutes of things.

So, how do you revise Johnny? Need your bright eyes and enough patience, hehe!

1. Delete a path that does not exist in the Android source code in Classpath.

If it does not exist, delete it, yes, remove <classpathentryxxxx/> entire label.

At the end of the file you will see a similar <classpathentry kind= "Lib" xxxx/> tag, note that there is a need to delete, see clearly.

2. Appropriate additions

If you are modifying the application layer development, you certainly want to packages/apps/the following code, but some of the classpath is not, then you add it manually.

Here is an example of adding gallery3d.

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

Here need to note: Add Gallery3d do not add Gallery (class repetition), or just add Gallery, do not add Gallery3d, or error.
If not in your classpath:

<classpathentry kind= "Lib" path= "out/target/common/obj/java_libraries/android-common_intermediates/ Javalib.jar "/>

You can add it manually!

V. Modifying the Eclipse configuration file

There is a profile in the Eclipse root directory: Eclipse.ini, locate and open it.

1.-xx:maxpermsize=256m
2.-xms128m
3.-xmx512m

In your profile, you want to have the same configuration as the above three, if not or inconsistent, please add or modify.

Six, import source

1. New Java project in Eclipse, not Android project.

2. Select Create Project from existing source and specify to/HOME/MARK/ANDROID_SRC.

3. Wait for the import, let time to prove everything, this time you can take a break. Stretch a stretch, hehe!

If you have an error importing eclipse, it may be that you did not follow the above patience, or just. Classpath modified incorrectly.

If you are working under Windows, you can use the Share feature to import the compiled source code from Linux under Windows and then use Eclipse development under Windows. Concrete steps like above, no longer repeat.

For more information on Android-related content readers can view the site topics: "Android Development Introduction and Advanced Course", "Android Multimedia operating skills Summary (audio, video, recording, etc.)", "Android Basic Components Usage Summary", " Android View tips Summary, Android layout layout tips and a summary of Android controls usage

I hope this article will help you with the Android program.

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.