Eclipse Import Android Launcher3 run

Source: Internet
Author: User

A recent need to customize the launcher,android version of a MTK handheld device is the 4.4.2,launcher version of Launcher 3. In fact, there are a lot of articles online about how to import Android 4.0 Launcher 2 source into eclipse run. Like what:

1. http://blog.csdn.net/chenshaoyang0011/article/details/7857634

2. http://blog.csdn.net/klpchan/article/details/11843295.

At the same time I found a piece about how eclipse imports the Launcher 3 article:

http://blog.csdn.net/deng0zhaotai/article/details/42045359

Basically in accordance with these three blog posts, I successfully introduced launcher 3 to eclipse so as to facilitate the modification of the customization, hence the record

The first step: Import project, named Launcher3. After creating the project need to select the Android SDK version, right-click Project->properties->android Select the SDK version, here I choose API 19.

The second step: After the first step, there will still be countless errors in the project, this is because the project was pulled down from the source, the project source with a lot of Android open API. At this point, you need to compile the Android source code, because you need to compile the generated Class.jar files, so that you can use this part of the API. After compiling, find a few files in out/target/common/obj/java_libraries (the arrow means rename):

1. Android_support_v13/class.jar-----> Android_support_v13.jar

2. Framework_intermediates/class.jar----->framework.jar

3. Common_intermediates/class.jar----->common.jar

4. Core_intermediates/class.jar----->core.jar

The above four files are used to invoke Android's open API in the project code. Create a new user library in the project's Java Build path, and then add the 4 jar files to the new user library. It is important to note that this library does not need to be compiled into the project, so in the Java Build path of the Order and Export tab, only need to move the library to the top, do not need to tick the previous check box. Otherwise, the compilation will go wrong.

These jars are used by ordinary launcher 3. And from the Android.mk file of the project found below, the project should also need another MTK library,

Local_static_java_libraries: = android-support-+= + mediatek-framework

5. Mediatek-framework_intermediates/class.jar----->mtk_framework.jar

6. Com.mediatek.launcher3.ext_intermediates/class.jar----->mtk_launcher3_ext.jar

After configuring the above jars, you will find that there are still errors. The following two jar packages are also required for the inspection of source code discovery

7. Mediatek-common_intermedias/class.jar----->mtk_common.jar

8. Com.google.protobuf.jar (This jar package is downloaded from the Internet)

The above 4 jar packages need to be compiled into the project because the API that relies on these packages in the code does not belong to Android. If you need to compile into a project, the import is different from the previous internal jar package. You need to add the above 4 jar packages to the project's Libs folder (if not, create a new one in the project's root directory). All the jar packages imported into the Libs folder will be automatically added by ADT to the Android Private libraries of the Java Build path, and the check boxes in front of them are selected by default (which means they need to be compiled into the project).

After importing the jar package two times above, the error is much reduced. But there are still mistakes in the project. Finally, we find that a class Backupprotos.java is missing. The class should be in the Com.android.launcher3.backup package. Among them, Backupprotos.java can be easily found on the Internet. There are two ways to solve this problem, one is to create a new package directly in the project and put the Backupprotos.java inside. The other is to use the JAR-CF command to package the file into a jar, and then put it in the Libs folder.

After you import all the dependent jar packages, you find that the compilation is still wrong, and the error indicates that there are duplicate Dex files in the project. After the investigation found that there is a com/android/launcher3 in the Mtk_launcher3_ext.jar package, presumably it should be the package and the project has a conflict. Therefore, pull down the file that generated the jar package in the source code, delete the Com/android/launcher3 directory, recreate the jar package, and replace the original jar package in the Libs.

After the above steps, it is still wrong to find. The LOGX class that was found to be called by the Launcherlog class in Mtk_launcher3_ext.jar is not found. For convenience, I created a launcherlog class directly in the project and replaced all references to Launcherlog in the MTK package. This Launcher3 the transplant successfully.

But this still can't run on Android emulator. Because Com.android.launcher3 's package name and LAUNCHER3 registration in the simulator are the same, it cannot be installed. One way to do this is to rename the project's package name, which is too much to change. Another way is to unload the Launcher3 on the emulator. This involves removing the system app from ADB. Run the ADB shell, and then re-mount the/system directory as read-write by using the following command:

su Mount grep system# learned which disk was hanging in the/system directory, such as/dev/Sda6Mount -o Rw,remount/dev/sda6/system

You can then uninstall the system software by using the ADB Uninstall command or simply deleting the corresponding apk file in the/system/app folder. This allows us to run our imported Launcher3 project on the simulator.

Eclipse Import Android Launcher3 run

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.