Skip to content

Instantly share code, notes, and snippets.

@deepakpk009
Created August 8, 2017 09:26
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save deepakpk009/0656674505a3f0fc0c0b0d46d8fdefb4 to your computer and use it in GitHub Desktop.
Save deepakpk009/0656674505a3f0fc0c0b0d46d8fdefb4 to your computer and use it in GitHub Desktop.
how to add a git android library project as a sub module, to a project
how to add a git android library project as a sub module, to a project
1. create an android project
2. add to vcs (vcs - import into version control - create git repository)
3. goto terminal and add sub-module - make sure the location folder name is different than the original project name
git submodule add https://XXX@bitbucket.org/YYY/ZZZ.git
4. goto file menu - project structure
5. click '+' on left top
6. select 'import gradle project'
7. select the sub-module folder
8. give the actual sub-module project name
9. sync
10. if the sub-module is not a library then convert it to library. follow steps:
in the sub-module build.gradle file change
a) apply plugin: 'com.android.application' - apply plugin: 'com.android.library'
b) remove applicationId
c) if the library doesnot require theme then dont specify one in the manifest.
if specified then that theme must not conflit the application theme or else it will not enable gradle build
11. now in the main project add compile project(':lib-name') within the dependencies section
12. gradle sync
13. the application theme of the library and the app mismathc it will show error.
make sure they are same, or remove the theme for the library
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment