Precautions for Android Application Development (this version is more efficient)

Source: Internet
Author: User

1. There are many online tutorials for compiling the kernel.


2. after the source code is compiled, the IMG image and some tools will be generated under the corresponding directory. Most of the practices on the Internet are to import environment variables in the current user's home directory. add the following configurations to bashrc:

Export android_product_out = ~ /Project/Android/cupcake2/out/target/product/generic

Android_product_out_bin = ~ /Project/Android/cupcake2/out/host/linux-x86/bin

Export path =$ {path }:$ {android_product_out_bin };

Synchronize Environment Variables

Source ~ /. Bashrc

Run the command

Emulator-image system. IMG-data userdata. IMG-ramdisk. img

Isn't it a problem? I need to repeat a long string of emulator xxx every time.

Google provides a much easier approach (http://source.android.com/source/using-eclipse.html, including importing source code)

First, comment out the rows you configured in. bashrc.

Execute source build/envsetup. Sh # in the source code root directory (each time you run this shell file, some scripts will be generated for us to do a good job for us)

Run

Lunch 1

Make # (you can skip this step because it has been compiled before. If it is not successful, add this step again)

Emulator # Start the simulator. Everything is OK. Save the following parameters

3. Edit the code in eclipse. Now it seems that the steps are relatively simple, but I can't understand how others teach me on the Internet. This morning, we found this http://source.android.com/source/using-eclipse.htmlto try it out and succeeded.

Run the command in the source code root directory.

CP development/IDE/Eclipse/. classpath. # note that the last vertex (.) represents the current directory.

Chmod U + W. classpath # by default, users in the group do not have the write permission, saving trouble and adding the write permission.

(The above two parts can be operated through the graphical interface, including permission modification and Attribute Modification)

You also need to change the eclipse configuration, mainly to configure the JVM heap size. If the memory is too small, the import may cause memory overflow, even if no memory overflow error occurs, if the heap memory is too small, garbage collection will be performed frequently, and the collection will be paused for a short period of time.

Change

-Xms128m

-Xmx512m

-XX: maxpermsize = 256 m

Now create a Java project through eclipse

File> New> JAVA Project

Enter project name

Select "Create project from existing source" and select the root path of the android source code in browse. Note that it is the same as the path because. classpath is copied to the root directory. classpath can see the configuration in it to find out why this operation is necessary.


4. compile the system application every time. IMG is really troublesome. You can delete the source code you want to develop under out/target/product/generic/system/APP after compiling the source code, and then return to the source code root directory make Snod, this command is used to create a system. IMG (very slow, it takes several minutes on the Virtual Machine) will package the application under the directory (System/APP) in system. IMG. Because this application is not included in the package, you can install ADB install xx.apk by using make or Uninstall. ADB uninstall com. xx. xx ..


5. It is difficult to delete system applications without following the above operations. I tried various methods on the Internet to delete system applications, but none of them worked. This method is the most efficient, although you can make system. IMG each time after compilation, and then start the simulator. But as you can imagine, you can test 20 times a day, even if your system is good.

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.