Import system applications to eclipse

Source: Internet
Author: User

 

Build an eclipse development environment for Android applications

First, copy the application to be modified from the Alps (source code root path) \ packages \ apps directory to the local machine, and then create an android project in eclipse, select Create project from existing source to introduce the application,

In general, you only need to set the two folders core_intermediates under the Alps (source code root path) \ out \ target \ common \ OBJ \ java_libraries \ path, and the classes under framework_intermediates. jar files, respectively renamed as core. jar, framework. jar. Remove the default Android. jar file of the project, and add the two jar files.

1) Alps \ out \ target \ common \ OBJ \ java_libraries \ core_intermediates, copy the class. jar file and change it to core. jar.

2) Alps \ out \ target \ common \ OBJ \ java_libraries \ framework_intermediates, copy the class. jar file and change it to framework. jar.

3) If you need other jar packages, press 1) 2) in Alps \ out \ target \ common \ OBJ \ java_libraries \, find the corresponding jar package and import it to the project.

3) Add a new user library in eclipse. For example, the name is Android-lib (you can name it yourself)

4) set this android-lib to system library, and add core. jar and framework. jar to this android-lib.

5) in your project, remove the original Android Library: android2.1-update1 or android2.2, and then add the new Android-lib to your project.

6) enjoy debugging.

If there are other classes that cannot be found, you can first see where the class is defined, go to the apps or java_libraries directories in the Alps \ out \ target \ common \ OBJ \ directory to search for the desired class, and then import the searched class to the project. Pay special attention to eventlogtags. java file, which is generated during system compilation. Each application corresponds to a different eventlogtags. java, so make sure that the file found is the file required by the project.

For. aidl File Processing: General. the aidl file reports errors because other errors are introduced. the aidl file cannot be found. In this case, you only need to copy the corresponding aidl file to the project and create the corresponding package name for the aidl file under SRC, and move the aidl file to the new package.

 

 

Import Android launcher2 to eclipse and run it.

1. Import the launcher2 project to eclipse.
At this time, the launcher2 project has been imported into eclipse, but there will be more than 100 errors.

2. Add the package file used by launcher2.

In the android source code, many methods, members, classes, and packages are tagged with @ hide, which are not disclosed in the SDK, android is the most common class used to compile the launcher source code. view. view member mscrollx cannot be accessed. Therefore, you must first download the android code and compile it properly, because you need to use some compiled class. Jar files.

Here we use: (the generated package path is out/target/common/obj/java_libraries)
1) framework_intermediates/classes. jar: This is mainly the framework class of Android.
2) android-common_intermediates/classes. jar: This contains the com. Android. Common. Search Class
3) core_intermediates/classes. jar: This package contains the Dalvik. system. vmruntime class.

These are all packages that need to be imported into the project. You can add these packages by configuring the build path of the project,
Right-click the project name and choose build path> Configure build path...> libraries> Add library> User libraries...> New...
Add the three dependent packages one by one and name them android_framework, android_common, and android_core respectively.
After adding the three packages, you also need to put them in front of the android2.3.3 package. You can select order and export in build path configuration.
At this time, you will find that the launcher2 project and there is no error, you can also compile it.
3. Modify the launcher2 package name and run the changed launcher2.

Change the name of the original package. Remember to use the eclipse rename mechanism (Press F2 on the package name to modify), which is not only a reference to the class, there are also many references in XML files (such as import COM. android. launcher3.r;), all of which can be done at one time as long as the rename is good.

New name: enter your own package name,Select all the following four items. Click "preview"

Note: It is best not to place your project in the Chinese path. Otherwise, an error will occur during rename. I started to put the error in the Chinese path for a long time before I found the error!

4. Delete this sentence in the androidmanifest. xml file. (Android: shareduserid = "android. uid. Shared ")

In this case, I used launcher 2.3 to perform the experiment. The result was okay and the operation was successful!

 

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.