Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What problems should be paid attention to when compiling Android 2.2 source code?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article shows you what problems you should pay attention to when compiling Android 2.2 source code, which is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

The compilation of Android 2.2, make directly from the source code to ok. Need jdk6! The time required for this compilation varies depending on the machine configuration. It took me about two hours to compile it all. The compiled files are in your source directory / out/

Compile sdk after compilation

Cd / android/src. Build/envsetup.sh lunch sdk-eng make sdk

It should be noted here that there is a part of Android 2.2 compiling sdk that requires jdk5 to compile doc! There are many methods introduced on the Internet, and I have adopted direct comments (that is, skipping the compilation of doc). This eliminates the need to switch versions of jdk in the development environment. To do this, annotate the line ALL_DOCS + = $(full_target) in the file build\ core\ droiddoc.mk (preceded by #).

At this point, you can use jdk5.0 when compiling source code and jdk6.0 when compiling sdk, but still comment on the line ALL_DOCS + = $(full_target) in the file build\ core\ droiddoc.mk. With regard to using two versions of jdk, I do this: go to the sun official website to download both jdk1.5 and 1.6 installation packages and install them. Specify JDK_HOME JRE_HOME and other environment variables in / etc/profile. When you want to switch versions, just write the path of the corresponding version in the environment variables here, then source profile, and then java-version to check the version. Sometimes it may take effect only if you restart it.) as shown in the figure

After sdk of Android 2.2 compiles OK, the sdk directory is generated under the ou/host/linux-x86 directory of 1. The content generated in it is basically similar to the sdk downloaded from the Internet, as shown in the figure: (click to enlarge)

Install the ADT plug-in for Eclipse. Sdk for android 2.2 requires at least 0.96 ADT. You are compiling the sdk of Android 2.2. do not use the 8.0 adt that has been officially upgraded, as you will not recognize the simulator in eclipse. (updated on 2010-12-10) and when installing the ADT plug-in, jdk needs jdk...6_21 (my colleague reported a null pointer exception when it was 6: 15. If you reinstall jdk, update java_home and other environment variables).

At this point, there will be an error in the compilation of the newly built Android 2.2 project. Unableto get buffer of resource assetfile . It's a mistake like the one before. There are also many solutions online. I used a more straightforward one: by overriding the resource.arsc in the android.jar package. This resource.arsc file can be copied into the android.jar of sdk under win, and then pasted directly into the compiled android.jar.

The solution is to set the product of build sdk to sdk. There are two ways:

1. Use lunch to change the configuration:

Cd / android/src. Build/envsetup.sh lunch sdk-eng make sdk

The above content is Android 2.2 source code compilation need to pay attention to what problems, have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report