Android now represents the system's open source phone operating system has been updated to 4.0.3 Version number. Due to its open source features. The operating system itself has the greatest flexibility, but also caused by the variety of version number, the market appears to be mobile phone manufacturers or ROM. But how to develop the Android system framework layer that. We know that using Eclipse+adt will enable the development of Android applications. Use your phone or simulator to debug the corresponding effect.
This is a standard application development process, but when you develop a custom apk for custom ROMs, you often face the use of a modified framework. The most common scenario is the development of an interface that was originally @hide in the framework. Or add a new interface of your own definition. We know that the use of such interfaces in eclipse will directly error, not to compile, let alone code tracking and debugging. In fact, this can be compiled using the corresponding Java file. Class into the Eclips Lib Reference library and increase the call priority. will be able to cross this barrier for application development. The order is for example the following:
In Project's build Path, the addexternal Class Select the corresponding. class folder path, and do not forget to add, and then put the called class in order before the system Framework.jar, so that the relevant compilation can be completed. And be able to perform normally on the phone. It is important to note, however, that you want to use a custom framework-related interface. Phone system support is required.
That is, the corresponding handset has a corresponding ROM ability to call this part of the interface normally.
The associated. class file is the intermediate code in the package (out\target\common\obj\) that corresponds to the system source code compilation. Depending on the interface source code location, the corresponding folder to find.
Assuming you don't want to be so troublesome, you can replace the entire framework code directly!
, the folder is Out\target\common\obj\java_libraries\framework_intermediates, In the following Classes-full-debug.jar, this is the uncompressed jar package, which has all the Fraemwork source code generated by the. class file.
1. in the project you need to use:
Click Build Path. Click Add Libraries:
Select User Library and click Next :
Click User Libraries :
Click New :
Enter a name in the New User Library dialog box. To be able to name themselves, here named Myframework. tick on:system library. Click OK so that you do not have to look for the corresponding. class file, directly using the new framework interface method.
1. Select the Android app's project-right-click-properties-libraries-add Library, and theADD Library dialog box appears. Select "User Libraries ...". (Fig. 1)
Figure 1
2. Pop up the "User Libraries" dialog and click "New". Popup "New User Library" dialog: the name of the new library ("FrameworksJar4.2.2", the library name can be defined by itself), and select "System Library" (Add to the boot class Path) ", click OK (Figure 2)
Figure 2
3. (Figure 3) in the "User Libraries" dialog, you will be able to see the new "FrameworksJar4.2.2" library name that you have defined. Click "Add External JARs ..." (select Classes-full-debug.jar, provided the Android source code has been compiled and the jar file has been obtained);
Figure 3
4. As you can see in Figure 4, the library "FrameworksJar4.2.2" that you define is already associated with Classes-full-debug.jar .
Click "OK" in Figure 4. Figure 5, "Finish";
Figure 4
Figure 5
5. You can see the "Libraries" tab under the Java Build Path , with the new "FrameworksJar4.2.2" Library just created (Figure 6).
Figure 6
6. The need to Under the "Order and Export" tab under Java Build path , top "FrameworkJar4.2.2". Otherwise, project may compile just.
7. You can also see it in Project for Android (Figure 7), the "FrameworksJar4.2.2" library can be used by project.
Figure 7
Attention:
1. Assume that the "Libraries" tab is directly under the Java Build path . Select "Add External Jar ..." and add "Classes-full-debug.jar". When you debug project, you may get stuck and pop up a "Java Heap Space" error.
Use Androidframeworks to develop and apply hidden classes or Android using custom framework development and applications