0

I followed the steps in How to share a single library source across multiple projects to add an external library to a project.

My project(s) structure:

Project MyTest1:
  Module MyLib

Project MyTest2:
  Module MyApp

I edited settings.gradle in MyTest2 and added , ..:MyTest1:MyLib to the include directive. Now, I am able to see and use the external library project from within MyTest2 project. Things work as expected.

However, I see a spurious module ".." alongside MyApp and MyLib. There are no nodes under it and it doesn't seem to cause any problems. I am wondering what exactly is this module for and if there is a way to get rid of it. Regards.

Edit

Both my projects are under a directory C:\MyDev. It appears that, anytime you bring up MyTest2 project, AS modifies a file MyTest2.idea\modules.xml and inserts the following line:

<module fileurl="file://C:/MyDev.iml" filepath="C:/MyDev.iml" />

It then complains that the module was not loaded and creates a fake ".." module. I think this is the root of the problem.

Community
  • 1
  • 1
Peter
  • 11,260
  • 14
  • 78
  • 155

1 Answers1

0

Do not declare ..:MyTest1:MyLib as your include. It will cause many problems. Instead, declare it the following way:

include ':MyLib'
project(':MyLib').projectDir = new File('../MyTest1/MyLib')
Peter
  • 11,260
  • 14
  • 78
  • 155