Could not resolve all dependencies for configuration (gradle 3.2.1)

I have two separate projects: (A) is Android application and (B) is java library. So (B) project is building by itself and ./gradlew check shows no errors. But when I use (B) as a module in (A) ./gradlew check shows the following 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 :new-project.`

In project (A) I have added (B) by adding the following to dependencies compile project(':new-project') and settings.gradle looks looks like this:

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

Project (B) has completely different dependencies (none of those is cross-referencing with dependencies from project A) and settings.gradle contains just one line include ':new-project'.

What could be wrong?