Eclipse Android project, how to reference library within workspace?

后端 未结 1 2021
一个人的身影
一个人的身影 2020-11-29 04:56

I followed some steps I found here (can\'t find the URL right now, sorry) to convert my Android project in Eclipse to a layout where 99.9% of my code is in a library project

相关标签:
1条回答
  • 2020-11-29 05:29

    The classical Eclipse/Java way

    Add a (workspace) library

    • Right click the project you want to insert in.
    • Click Properties.
    • Select Java Build Path.
    • Select the Libraries tab.

    Now, it depends how you compile your library. So either do an Add JARs... or an Add Class Folder. Choose the external variant to use an external source. That's it.

    Add a workspace project

    • Right click the project you want to insert in.
    • Click Properties.
    • Select Java Build Path.
    • Select the Projects tab.

    Click Add... on the right side and you are done.

    The additional Android way

    Two steps are necessary:

    • Mark the project you want to use as library project
    • Reference the marked project

    Mark the library project

    Right click your project and select Properties. Select Android on the left and tick the checkbox IsLibrary. Done.

    Reference the marked project

    Right click your project and select Properties. Select Android on the left and Add... your marked project. It will be added to the list and is ready to use. Now you are able to access all classes and ressources (e.g. drawables, strings) from the referenced, marked project. Awesome, eh? :)

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