Use Eclipse to export jar files in Android Projects
The weather was fine in March 24, 2014.
When I came to a new company, I came into contact with a field that I had never touched on before. In fact, it was not a field, that is, SDK development. I am very depressed. I have no experienced mentor to bring me down. I have been in touch with Android for a long time, and I have also done SDK access. It is basically the same and there are no many differences. The current company wants me to access the game platform SDK. this is not difficult. The problem is that no one in my team knows how to export jar from Eclipse, I asked if our company had used SDK access before. How did we package jar files? I thought the question I asked was too low-level. When someone else was eager to answer the question, I didn't know it at all ,,,,.
It is certainly useful to package Android components. For example, if a module is developed, we may package it into a jar file for reference by other projects for better reuse. This is easy to understand. There are a bunch of articles on the Internet that use Eclipse to package Android projects into jar files. I don't want to say much here. I just want to briefly describe the problems I encountered when creating the SDK:
[Use Eclipse to export jar packages]
1. How is the Android project associated with other jar or library files?
2. Use Eclipse to export Android projects as jar files. Which ones need to be checked and which ones do not need to be checked?
3. If the exported jar package cannot be used in the Android project, an error related to "java. lang. NoClassDefFoundError" will be reported. How can this problem be solved?
4. the Android project depends on other jar files or libraries. The exported jar package cannot be used for integration at this time.
This section is reprinted.
First, the basic features of the Android project are as follows:
Of course, the corresponding Activity file has been deleted, because when compiled into a jar package, we do not need the Activity file.
The preceding project is used as an example to package it into a JAR package. The steps are as follows:
Right-click the project and select export:
Select the export target: java-> JAR file:
Check unnecessary files, such:
Generally, files that do not need to be imported into the jar package include:
1. activity files in the/src/directory
2. files under the root directory,. classpath,. project, manifest. xml,. properties,. cfg, etc.
3. Files in the/bin/directory, such as manifest. xml,. dex,. apk, and resources. ap _.
4./bin/res directory
5./res/drawable-related directories
6./res/layout/directory
7./res/menu/directory
This step has been basically completed. Just browse and select the export path of the jar file.
The above explains how to export an Android project as a jar file. In fact, there is no problem in this case, because this is a normal situation of generating jar files.
The more troublesome situation is:
The Android project you want to package as a jar package also depends on the jar package or library. How can this problem be solved?
I have been surfing the internet for a long time. I have read some blog posts, but I still haven't found a solution. I directly used Eclipse to package the Android project. Can I associate the dependent jar files or libraries? It doesn't seem so powerful. I have also studied the sdks provided by some platforms. How do they work?
If there is a dependency on jar in Android, you can no longer package it into a jar file. We can use it as a library file for reference by other projects, for example, the library used by Doku sdk is an Android project.
Dooku sets it to Is Library
·
The demo provided by docool is referenced as follows:
There are still many questions about the SDK. I still don't know how the problem was caused. I hope I can leave a message and discuss it together.
At work, you may encounter colleagues who are too self-reliant to share their own things. In fact, even if you put things in bad shape, others will not feel anything amazing, or a teammate like a pig needs to be patient and calm at this time. I told myself that I must be good at myself, take my work seriously, establish a good relationship with my colleagues, and start work happily every day, it will not put yourself in a depressing state.