In my Android application I've created a new library module. Now I have this structure:
Right now I have under version control on Bitbucket whole project less datingcorelib. I would like to use a different repo to this library module.
It's possible to use two different repos on the same project?
Thanks in advance.
Yes, it is possible. You're looking for a thing called submodule.
However, it may be tricky to use such a submodule within a project as it will have its own structure. So you also need to include the right gradle project from that submodule.
Let's say you pushed your library project somewhere. Let it be
email@example.com:Sami/my-library.git. We also assume that it has the common structure for Android library project, i.e. it has a root
build.gradle file and a subfolder
datingcorelib with actual source code. This is what we need to include into the app.
You need to delete
datingcorelib from your app's project. Then add the library as a submodule:
git submodule add firstname.lastname@example.org:Sami/my-library.git libraries/datingcorelib
After that open
settings.gradle file of your app's project and add a new line there:
project(':datingcorelib').projectDir = new File("$rootDir/libraries/datingcorelib/datingcorelib")
Sync the project. Now you should be able to use the code from another repository.