Search code examples
androidgradleandroid-gradle-pluginbuild.gradlegradlew

Why did gradlew :app:dependencyInsight fail?


I try to run this command to list all the dependencies of firebase-messaging library :

gradlew :app:dependencyInsight --configuration compile --dependency firebase-messaging

but it's return me :

:app:dependencyInsight No dependencies matching given input were found in configuration ':app:compile'

BUILD SUCCESSFUL in 0s 1 actionable task: 1 executed

this is my build.gradle file :

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.test.myapplication"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:design:27.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation 'com.google.firebase:firebase-messaging:12.0.1'
}

What i did wrong ?


Solution

  • That's because firebase-messaging is declared in the implementation configuration. compileClasspath should be used

    Try :

    gradlew :app:dependencyInsight --configuration compileClasspath --dependency firebase-messaging
    

    edit : using compileClasspath won't work with Android as described here

    Using gradle :app:dependencies to fetch all dependencies seems to be the cleaner way to get all the dependencies of firebase-messaging