Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

app declares a dependency from configuration 'compile' to configuration 'default' which is not declared in the descriptor for project

I am importing a library module named "wear" in my project and while building, I am getting this:

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

What does it mean? How can I get rid of this?

like image 785
rarahat02 Avatar asked Mar 21 '17 14:03

rarahat02


4 Answers

This error usually occurs when Gradle cannot find a particular component. I experienced this when trying to use the Salesforce React Native Android example.

The error message you get looks like the one you posted ... in my case it was

Project :app declares a dependency from configuration 'compile' to configuration 'default' which is not declared in the descriptor for project :libs:SalesforceReact.

I found my Gradle settings file ( called settings.gradle ) in the projects android directory. The start of it looked like this

rootProject.name = 'SmartSyncExplorerReactNative'

def libsRootDir = new File( settingsDir, '../node_modules/SalesforceMobileSDK-Android/libs' )
include ':app'

include ':libs:SalesforceReact'
project( ':libs:SalesforceReact' ).projectDir = new File( libsRootDir, 'SalesforceReact' )

In this case, the path given in libsRootDir did not exist (as these libraries actually came from a different repository which I cloned and then pointed this path to!).

Once I had corrected the path, save the settings file and reran, everything worked smoothly.

I hope this helps, Jonathan.

like image 186
Jonathan Dawson Avatar answered Nov 17 '22 08:11

Jonathan Dawson


I have faced same issue when i update android studio 3.0 and following solutions works for me

implementation project(path: ':yourModule', configuration: 'default')

This solution will work if you are using Gradle 4.1 and above and Gradle Plugin Version 3.0.0 and above.

I hope this will work for you

like image 15
Saurabh Bhandari Avatar answered Nov 17 '22 09:11

Saurabh Bhandari


I ran into a similar issue with a different set of modules. I was finally able to resolve it by reinstalling the necessary modules via npm but with the --save flag. i.e. npm install --save module-name

It looks like if you just have the .iml file in the module folder, it's not enough for the android studio to resolve it.

Good luck.

like image 5
John McClelland Avatar answered Nov 17 '22 09:11

John McClelland


I found this error too. So, I noticed that my settings.gradle was searching for a path that didn't exist. Example: (settings.gradle)

project(':YourProjectV1').projectDir = new File('../YourProjectFolderV1/app/');

However, in my filesystem, the path was: ../YourProjectFolderv1

After syncing the names, the project was ok!

I hope that helps.

like image 5
Ramon Costa Avatar answered Nov 17 '22 10:11

Ramon Costa