I use ActionBarSherlock in my app and have base classes for all of my activity and fragment classes that subclass from ABS entities. I would like to extract these base classes into their own library project for use in multiple apps.
Currently my project looks like this: MainProject - uses ActionBarSherlock - uses LibraryB - uses libraryC
I would like to structure my code as follows: MyLibrary - uses ABS - uses LibraryB - uses LibraryC
MainProject1 - uses MyLibrary
MainProject2 - uses MyLibrary
The classes in the ABS,LibraryB and LibraryC namespaces need to be accessible to the top level projects. For example com.actionbarsherlock.view.Menu/MenuItem
in sublcassed activities. If possible, I would like to include only one copy of any library project within the main project.
Is this setup possible or reasonable?
Searching for information information on android nested library projects has given conflicting information but links to SO posts that I missed and make my question look stupid are just as appreciated and actual answers.
thanks
Yes it's doable, I'm using this type of hierarchy in my Apps.
Basically I have some "front" apps :
:MyApp
:MyApp1
:MyApp2
And a "Core" module (which is an android-library module)
:Core
:Core:dependencies (modules dependencies)
:Core:libs (jars)
And using Gradle I compile some aar in my Core
module :
compile 'com.android.support:support-v4:19.0.0'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
Every Apps (MyApp, MyApp1, MyApp2) use Core
module and can use ABS and every other library included in my Core
Module.
I suggest you to look into Gradle. It's a clean and powerfull way to deal with dependencies.
http://tools.android.com/tech-docs/new-build-system/user-guide
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.