littledog
littledog

Reputation: 258

Add dynamic feature module in a Eclipse Style Android project

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

Answers (2)

Shanker
Shanker

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

Ben Weiss
Ben Weiss

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

Related Questions