[Android] How to develop the Android Launcher in Eclipse withoutre-Compile Android Source

– Preparation of Source Code

1. Build the Android Source

2. Make a copy of Launcher from Android source tree

3. For all source files, you should change the package name from “com.android.launcher2” to “com.android.newname”. The “newname” is the name you want to call for this new launcher. If the source file contains “import com.android.launcher2.R”, you should also replace it with “import com.android.newname.R”. The name of Launcher class has to be changed to a new name, so you all the definitions and caller statement should be changed, too. In the Eclipse, you can use the rename mechanism. This will help you to change these names correctly.

4. In the AndroidManifest.xml, the package name should be replaced with com.android.newname.

[sourcecode format=”xml”]<manifest    xmlns:android="http://schemas.android.com/apk/res/android"    package="com.android.newname"    >
<original-package android:name="com.android.newname" />…[/sourcecode]

Otherwise, you should delete the ‘android:sharedUserId=”android.uid.shared”‘ in this file.
– Jar Files and the Configuration in Eclipse1. Import the new Launcher project.2.

You can find out the “out/target/common/obj/JAVA_LIBRARIES” directory In the Android source tree. There are some jar files in this directory. Please import the necessary jar files to your Eclipse. Following is the step by step procedure,

Step 1: go to “Window > Preferences > Java > Build Path > User Libraries”

Step 2: New a library folder and to add the JAR files in “out/target/common/obj/JAVA_LIBRARIES” into it. Then, press OK.

Step 3: Open the new Launcher project and go to “Properties > Java Build Path > Libraries”

Step 4: Track into “Add Library… > User Library”, and then, to press Next button.

Step 5: Select all libraries in the window, and to press Finish.

Step 7: Select the “Order and Export” label. Let the priority of all the libraries you added before are upper than the Android SDK library (Currently is named “Android 2.2”).

Step 8: Press OK and enjoy it!

發佈留言