WichyCake
WichyCake

Reputation: 616

Gradle configuration error

If there are two independent projects but one of them (say project A, which is an android application) rely on the other (say project B, a simple java application/library) and can't work without it. Project B, on the other hand, considered as a stand-alone application and builds and works fine by itself. Each of these projects has settings.gradle file in a root directory which points to a source directory.

The structure of these projects is the same and looks like this:

project_name_root
  project_name
    src
    build.gradle
  build.gradle
  settings.gradle

settings.gradle has a line include :project_name'

And the problem is when I build the Project A using Project B as a module it throws the following error:

A problem occurred configuring project ':project-a'.
Could not resolve all dependencies for configuration ':project-a:_debugApk'.
Project :project-a declares a dependency from configuration 'compile' to configuration 'default' which is not declared in the descriptor for project :project-b.

Project A has settings.gradle which contains:

include ':project-a', ':project-b'
project(':project-b').projectDir = new File(settingsDir, '../project-b-java')

NOTE

If Project B would have a little different structure (bellow) Project A will work just fine with Project B as a module. But I'd prefer to stick to the previous structure.

project_name_root
  src
  build.gradle

Upvotes: 3

Views: 4212

Answers (1)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 365178

If the project B has this structure:

project_B_root
|--project_B_module
|---- src
|---- build.gradle
|--build.gradle
|--settings.gradle

the path used in the settings.gradle of the projectA must link the project_B_module folder , not the project_B_root folder.

Upvotes: 5

Related Questions