我尝试运行此命令以列出 firebase-messaging 库的所有依赖项:
gradlew :app:dependencyInsight --configuration compile --dependency firebase-messaging
但它会返回我:
:app:dependencyInsight No dependencies matching given input were found in configuration ':app:compile'
BUILD SUCCESSFUL in 0s 1 actionable task: 1 executed
这是我的 build.gradle 文件:
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'
}
我做错了什么?
最佳答案
将 dependencyInsight
与 compileClasspath
一起使用在 Android 项目上工作得很好(不像 accepted answer 似乎声称的那样)。你只需要在它前面加上完整的 build variant名字!
例如,如果您的项目仅使用构建类型,则使用 debugCompileClasspath
或 releaseCompileClasspath
作为配置参数。
如果产品 flavor 也在使用中,则形式为 flavorDebugCompileClasspath
(插入您自己的 flavor 名称)。
我项目中的一个工作示例(产品风格完整
,构建类型调试
):
./gradlew app:dependencyInsight --configuration fullDebugCompileClasspath --dependency gson
关于android - 为什么gradlew :app:dependencyInsight fail?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49646103/