How to reference an external jar in an Android Library project in Eclipse

后端 未结 3 581
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-13 17:40

Oh Android. How I love your verbiage.

I have a workspace with a few projects in it. App1 and App2 are Android applications. Common is an Android library project. App1 an

相关标签:
3条回答
  • 2021-02-13 18:04

    To augment omermuhammed's reply, if the common project is not one that is being changed frequently, creating a jar and using it in the other projects is a good solution.

    To create a jar right-click the project on Eclipse -> Export -> Java -> JAR file, then select the folders you want to include in the JAR, in your case I guess this includes the folders gen and libs (libs being the folder with the httpmime & apache-mime4j JARS), but probably neither res nor the root directory of your project (with files such as AndroidManifest.xml that will cause problems with the same file in the dependent projects).

    0 讨论(0)
  • 2021-02-13 18:12

    I think omermuhammed and Amit didn't get the fact that Visser is talking about a Android Library Project. For those project, I don't think it is possible to create a jar. ( jar has nothing to do with all the Android resources thing ).

    From my experience with Android Library Project, this kind of project are just, basically, the sources and the ressources packaged, and ready to be included in another project. But the settings are not part of the package, so you have to include the libs for each application. In my experience, this setting is not something that changes often, so it is not so bad.

    Android Library Project are still way from being perfect, but still a huge improvement from what was there before ( ie nothing ).

    0 讨论(0)
  • 2021-02-13 18:16

    Try compiling the Common project into a jar and adding it as an external jar to your App1 or App2 projects.

    0 讨论(0)
提交回复
热议问题