简体   繁体   中英

App Bundle - Dynamic feature modules : Base project not found in dynamic feature module error

I am working on a gradle android project which has custom project structure. We used sourceSets.main apis to make mappings for "AndroidManifest.xml ", "res" and others. There are no issues with this set up and all the functionality works fine.

In the project we are planning to implement dynamic feature module. As part of project configuration I have followed all the steps mentioned in android documentation https://developer.android.com/studio/projects/dynamic-delivery#feature_build_config .

As part of instructions, one has to put, base module as a dependency of the dynamic feature module, like below

dependencies {

// Declares a dependency on the base module, ':app'.
implementation project(':app')

}

When I compile the project, build is failing with below error, ("KSApp" is my main project name and "dynamic_feature" is dynamic feature module)

"Project with path ':KSApp' could not be found in project ':dynamic_feature'."

Can some one please explain, whats going wrong and how do I put base module as my dependency in dynamic feature module ?

What I tried :

  1. Using implementation project(${project.rootDir}") in dependencies section of dynamic feature module.

  2. Using implementation file(${project.rootDir}") in dependencies section of dynamic feature module.

Note :

I am able to successfully implement dynamic feature module in a regular projected created in Android studio. I see problem only in project with custom project structure .

Issue is in referring base module form sub module. As my project has custom android structure, base module is in root project folder. In this case, to refer base module from sub module one should use below approach:

dependencies {
    implementation project(':')
}

This is solving the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM