0

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.

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

1 Comment

I created a new project and move the root project code into the app module. It is a huge legacy project and a lot of configurations need to be changed. But it worked. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.