Dependencycheck: Gradle dependencyCheckAnalyze Build failed

Created on 9 Nov 2017  路  10Comments  路  Source: jeremylong/DependencyCheck

So after migrating the project to gradle 4.1.0 and android gradle plugin to 3.0.0, the ./gradlew app:mainModule:dependencyCheckAnalyze fails. Currently, my project runs smoothly after the migration but the dependencyCheck task doesn't work anymore. Worth mentioning that the task worked fine pre gradle 4.1.0 and android plugin gradle 3.0.0

My mainModule declares the dependency to the local library module likewise, so nothing fancy:
implementation project(':libraries_3rd_party:aLibrary')

The aLibrary's gradle has a release buildType and the only dependency is the android support v4. The mainModule has several build types: debug, release, buildType1 etc. All the buildTypes that are not release or debug have matchingFallbacks = ['debug', 'release']. The mainModule also has multiple flavours all assigned to only one dimension.

Task :app:mainModule:dependencyCheckAnalyze
Verifying dependencies for project mainModule

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:mainModule:dependencyCheckAnalyze'.

    Could not resolve all dependencies for configuration ':app:mainModule:flavour1DebugCompileClasspath'.
    More than one variant of project :libraries_3rd_party:aLibrary matches the consumer attributes:

    • Configuration ':libraries_3rd_party:aLibrary:debugApiElements' variant android-aidl:

      • Found artifactType 'android-aidl' but wasn't required.

      • Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.

      • Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.

      • Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.

      • Required defaultDimension 'flavour' but no value provided.

      • Required org.gradle.api.attributes.Usage 'java-api' and found compatible value 'java-api'.

  • Configuration ':libraries_3rd_party:aLibrary:debugApiElements' variant android-classes:

  • Configuration ':libraries_3rd_party:aLibrary:debugApiElements' variant android-manifest:
  • Configuration ':libraries_3rd_party:aLibrary:debugApiElements' variant android-renderscript:
  • Configuration ':libraries_3rd_party:aLibrary:debugApiElements' variant jar:
bug

Most helpful comment

I got the same error, and was able to work around it by changing dependency references like this:
implementation project(':foo-module')
to this:
implementation project(path: ':foo-module', configuration: 'default')

All 10 comments

Thank you for the bug report - the team will try to look into this soon.

I got the same error, and was able to work around it by changing dependency references like this:
implementation project(':foo-module')
to this:
implementation project(path: ':foo-module', configuration: 'default')

have you fix this issue now? when i work around with @jebstuart's suggestion, moudle "foo-module" dependency is not transitive.

Unfortunately - not yet. The team will try to get to this soon. PRs are welcome...

I don't know if this would help at all, but the error message looks similar to https://github.com/JFrogDev/build-info/issues/139 .

Unfortunately implementation project(path: ':foo-module', configuration: 'default') is no longer recommended for Android Gradle Plugin 3.0.0+.
https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html

As I understand there is no fix at the so far?

I believe this is also related to https://github.com/jeremylong/dependency-check-gradle/issues/71. I will try to look at this soon - but as always PRs are welcome. I have one fairly serious issue with the core engine that will require a number of updates before I can delve into this issue (for more info on the other issue see https://github.com/jeremylong/DependencyCheck/issues/1088).

Any solution for this?

According to this issue, there may be a problem with the Google services plugin:
https://issuetracker.google.com/issues/79235243

Downgrading the google services plugin to v3.2.1 will resolve the build error for now until Google releases a newer version of the plugin.

Was this page helpful?
0 / 5 - 0 ratings