Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 747
Katherine Avatar asked Dec 21 '25 23:12

Katherine


1 Answers

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.

like image 156
Gabriele Mariotti Avatar answered Dec 24 '25 14:12

Gabriele Mariotti



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!