Reputation: 258
I am trying to add dynamic feature module in my project. It was previously an Eclipse project so the structure is different from the Android Studio structure. The main application is in the root directory, not an independent module.
The project structure as follow:
/Project Root
Project Root Files
+Module1
+Dynamic Module
I want to add a dynamic feature module in the project, so I need to add the root project as the dependency of the dynamic module. Is there a way that I can do this? In the dynamic module build.gradle
file, I tried ':Root'
and ':'
, both did not work. Gradle said it could not resolve the root project.
Upvotes: 0
Views: 162
Reputation: 864
Even I faced the above issue and was able to resolve it by referring the base module in the dependency module with the below approach.
dependencies {
implementation project(':')
}
If the base module is in the root of the project, one should refer the base module in the dependency module with the ":" symbol.
Upvotes: 1
Reputation: 17932
Using a project structure that gradle can deal with is the important bit here.
You can migrate the project Root
to a different folder.
By convention that has been app
.
You then can refer to it from dependent projects as :app
.
The project structure would be then something like this:
.
├── build.gradle
├── app
│ ├── build.gradle
│ └── src
├── moduleA
│ ├── build.gradle
│ └── src
├── moduleB
│ ├── build.gradle
│ └── src
Upvotes: 0