How to compile launcher2 in eclipse

Source: Internet
Author: User
Transferred from dclchj

In view of a friend looking for resources is not convenient, I need to upload the resources required for this project, the need can download http://download.csdn.net/detail/dclchj/3928496 from this address

 

Home application of AndroidProgramLauncher2 is an important and complex program. The first interface that the user sees after the startup is it. Here we will introduce in detail how to import the launcher2 project in the android source code to the Eclipse project. It can lay a solid foundation for learning and modifying the launcher2 project.

I would like to thank my predecessors for sharing their materials online so that I can know how to proceed. However, this information is incomplete, which leads to some problems that I encountered when I followed yesterday, so that the problem can be solved until now.

 

The following is my development environment:

Operating System: windwos XP compiler: Eclipse

Android source code version: 2.3.4 Android SDK (adk) version: two versions are installed in the compiler: 4.0 and 2.3.3 (This project uses 2.3.3)

Java compiler compliance level 1.6 (this can be viewed and modified from project/properties/Java compiler)

 

Resources to be prepared:

Android2.3.4 compiled source code (the reason for compilation is that the compiled classes. jar file is used later)

Launcher2 project folder. (In the above source code path packages/apps)

 

Then you can start working. The following mainly references the Blog content of the two predecessors. The addresses are as follows: (we suggest you refer to these two articles .)ArticleLook, one of them has a very good picture !)

Http://univasity.iteye.com/blog/937547 and http://blog.csdn.net/chenzhixin/article/details/6264209

Additional references
Android 2.1 source code directory structureBaidu

If you read only one of the articles, it will fail. If you read both of them, you will still encounter problems. The following is a detailed summary of the success after practice.

 

**************************************** *******************

---------- This step is to add a project -------------

1. Copy the entire packages/apps/launcher2 folder in the source code to a directory, which cannot be an eclipse project directory such as wrokgroups. It is best to create a folder in the root directory of drive d without Chinese characters (habit)

2. Create an android project, select "Create project from existing source", and specify the path of the project, that is, the folder created in step 1. SDK you need to select (2.3.3) based on the Android version supported by the project you downloaded, and then "finish ".

3. Delete the project, and copy the folder created in 2 to the eclipse working directory.

4. File/import/General (existing projects into workspaces)/browse select the project copied in step 3. Then launcher is imported into eclipse. However, there will be a lot of red forks in the project, and we will solve this problem later.

---------- This step is to import the package file -----------

5. This section is used to copy the content of previous generations:

First, you need to compile androidCodeAfter compilation, some package files will be generated, and the following three files will be copied to the root directory of the d disk (you can choose any one)

Here we use: (the generated package path is out/target/common/obj/java_libraries of the source code)

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... enter any name (note that system library must be checked first), and then select Add jars to select three classes. jar. Repeat three times to import all three classes. Jar files.

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 (Note: select three new directories, then up is enough)

At this time, you will find that the launcher2 project and there is no error, you can also compile it.

--------- This step is to rename the package name -------------

6. This section is a copy predecessor:

To avoid conflicts with the default package name, you need to modify the package name.
1. In src/COM. android. right-click launcher and choose "refactor"-> "RENAME... ", the name can be customized (I will change it to com. study. launcher), select the option (select all)

2. Click "preview>" to preview it (if a warning is displayed on the way, skip this step and continue "countinue"). Remove unnecessary modifications here, otherwise it will be messy.

3. The new interface may contain the android package rename root node, which is checked before its subnode androidmanifest. xml. Then OK, an error may pop up, and you can use abort directly.

4. In Gen/COM. android. right-click launcher and choose "refactor"-> "RENAME... ", the name can be customized (I will change it to com. study. launcher), select the option (select all)

5. Same as above. Here, the check box before two root nodes: manifest. Java and R. Java should be deselected. Also OK.

 

**************************************** *******

After doing this, you can run it.

To sum up, we mainly follow the methods of the above two addresses, but pay attention to the points not mentioned in the two articles. Otherwise, an error will occur.

1. There are three packages to be imported, not one of them;

2. When importing a package, you must select the system library, which is not mentioned in the two articles. However, if you do not select the system library, the Red Cross disappears, A conversion to Dalvik format failed with error 1 is prompted during compilation. None of the methods on the Internet can be used. The solution is finally checked.

3. Rename the package name. In one article, only one package name is renamed. In the other article, two package names are to be named, but not how to do this. Just merge them.

 

After the above operations, eclipse can successfully compile launcher2 and run it in the simulator.

_______________________

PS:

Ritter Liu: Click the home key to select your launcher.

In view of a friend looking for resources is not convenient, I need to upload the resources required for this project, the need can download http://download.csdn.net/detail/dclchj/3928496 from this address

 

The Home application launcher2 that comes with Android is an important and complex program. The first interface that the user sees after the startup is it. Here we will introduce in detail how to import the launcher2 project in the android source code to the Eclipse project. It can lay a solid foundation for learning and modifying the launcher2 project.

I would like to thank my predecessors for sharing their materials online so that I can know how to proceed. However, this information is incomplete, which leads to some problems that I encountered when I followed yesterday, so that the problem can be solved until now.

 

The following is my development environment:

Operating System: windwos XP compiler: Eclipse

Android source code version: 2.3.4 Android SDK (adk) version: two versions are installed in the compiler: 4.0 and 2.3.3 (This project uses 2.3.3)

Java compiler compliance level 1.6 (this can be viewed and modified from project/properties/Java compiler)

 

Resources to be prepared:

Android2.3.4 compiled source code (the reason for compilation is that the compiled classes. jar file is used later)

Launcher2 project folder. (In the above source code path packages/apps)

 

Then you can start to work. The following mainly references the Blog content of the two predecessors. The addresses are as follows: (we suggest you refer to these two articles. One of them has a good picture !)

Http://univasity.iteye.com/blog/937547 and http://blog.csdn.net/chenzhixin/article/details/6264209

Additional references
Android 2.1 source code directory structureBaidu

If you read only one of the articles, it will fail. If you read both of them, you will still encounter problems. The following is a detailed summary of the success after practice.

 

**************************************** *******************

---------- This step is to add a project -------------

1. Copy the entire packages/apps/launcher2 folder in the source code to a directory, which cannot be an eclipse project directory such as wrokgroups. It is best to create a folder in the root directory of drive d without Chinese characters (habit)

2. Create an android project, select "Create project from existing source", and specify the path of the project, that is, the folder created in step 1. SDK you need to select (2.3.3) based on the Android version supported by the project you downloaded, and then "finish ".

3. Delete the project, and copy the folder created in 2 to the eclipse working directory.

4. File/import/General (existing projects into workspaces)/browse select the project copied in step 3. Then launcher is imported into eclipse. However, there will be a lot of red forks in the project, and we will solve this problem later.

---------- This step is to import the package file -----------

5. This section is used to copy the content of previous generations:

First, you need to compile the android code. After compilation, some package files will be generated, and the following three files will be copied to the root directory of the D Drive (you can choose any one)

Here we use: (the generated package path is out/target/common/obj/java_libraries of the source code)

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... enter any name (note that system library must be checked first), and then select Add jars to select three classes. jar. Repeat three times to import all three classes. Jar files.

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 (Note: select three new directories, then up is enough)

At this time, you will find that the launcher2 project and there is no error, you can also compile it.

--------- This step is to rename the package name -------------

6. This section is a copy predecessor:

To avoid conflicts with the default package name, you need to modify the package name.
1. In src/COM. android. right-click launcher and choose "refactor"-> "RENAME... ", the name can be customized (I will change it to com. study. launcher), select the option (select all)

2. Click "preview>" to preview it (if a warning is displayed on the way, skip this step and continue "countinue"). Remove unnecessary modifications here, otherwise it will be messy.

3. The new interface may contain the android package rename root node, which is checked before its subnode androidmanifest. xml. Then OK, an error may pop up, and you can use abort directly.

4. In Gen/COM. android. right-click launcher and choose "refactor"-> "RENAME... ", the name can be customized (I will change it to com. study. launcher), select the option (select all)

5. Same as above. Here, the check box before two root nodes: manifest. Java and R. Java should be deselected. Also OK.

 

**************************************** *******

After doing this, you can run it.

To sum up, we mainly follow the methods of the above two addresses, but pay attention to the points not mentioned in the two articles. Otherwise, an error will occur.

1. There are three packages to be imported, not one of them;

2. When importing a package, you must select the system library, which is not mentioned in the two articles. However, if you do not select the system library, the Red Cross disappears, A conversion to Dalvik format failed with error 1 is prompted during compilation. None of the methods on the Internet can be used. The solution is finally checked.

3. Rename the package name. In one article, only one package name is renamed. In the other article, two package names are to be named, but not how to do this. Just merge them.

 

After the above operations, eclipse can successfully compile launcher2 and run it in the simulator.

_______________________

PS:

Ritter Liu: Click the home key to select your launcher.

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.