How to soft import a module in a project in Android Studio?

时间:2016-04-12 00:40:04

标签: android android-studio gradle

I have 2 projects, MyLibrary, and MyProject. They each have their own repository. I want to develop and debug MyProject and MyLibrary together inside the same Android Studio window. I want to be able to add breakpoints inside MyLibrary and MyProject codes while I run my app. I tried using the Import module in Android Studio and it actually copied MyLibrary into MyProject repo. Is there any way I can just reference the MyLibrary as a directory path inside MyProject? So that I can commit my codes in their own repository?

Let's say my paths are:

MyLibrary - /Users/me/repo/MyLibrary

MyProject - /Users/me/repo/MyProject

Thanks

1 个答案:

答案 0 :(得分:0)

Add a module in your project repo, then configure its sourceSets (java, resources etc.) in module's build.gradle file to point to your library repo.

See this. And then add a compile dependency for your prjects. perform a gradle sync and you should be good to go.

Android sourceSets configuration