通过调试或发布过滤androidDependencies

时间:2018-02-27 10:20:15

标签: android gradle android-gradle

我的应用依赖项尽可能简单。我只void thread1() { ... while(running) { //get data from network .......... std::lock_guard<std::mutex> lock(mtx); map1.insert(data); } } void thread2() { while(running || !map1.empty()) { std::lock_guard<std::mutex> lock(mtx); //remove outdated elements from map ...... } } 支持库。现在我想知道我的应用程序中的依赖项。

implement

dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:26.1.0' } 可以帮助我显示应用的依赖关系。但结果有点长。

./gradlew -q :app:androidDependencies

如您所见,debug debugCompileClasspath - Dependencies for compilation +--- com.android.support:appcompat-v7:26.1.0@aar +--- com.android.support:animated-vector-drawable:26.1.0@aar +--- com.android.support:support-vector-drawable:26.1.0@aar +--- com.android.support:support-v4:26.1.0@aar +--- com.android.support:support-media-compat:26.1.0@aar +--- com.android.support:support-fragment:26.1.0@aar +--- com.android.support:support-core-utils:26.1.0@aar +--- com.android.support:support-core-ui:26.1.0@aar +--- com.android.support:support-compat:26.1.0@aar +--- com.android.support:support-annotations:26.1.0@jar +--- android.arch.lifecycle:runtime:1.0.0@aar +--- android.arch.lifecycle:common:1.0.0@jar \--- android.arch.core:common:1.0.0@jar debugRuntimeClasspath - Dependencies for runtime/packaging +--- com.android.support:appcompat-v7:26.1.0@aar +--- com.android.support:animated-vector-drawable:26.1.0@aar +--- com.android.support:support-vector-drawable:26.1.0@aar +--- com.android.support:support-v4:26.1.0@aar +--- com.android.support:support-media-compat:26.1.0@aar +--- com.android.support:support-fragment:26.1.0@aar +--- com.android.support:support-core-utils:26.1.0@aar +--- com.android.support:support-core-ui:26.1.0@aar +--- com.android.support:support-compat:26.1.0@aar +--- com.android.support:support-annotations:26.1.0@jar +--- android.arch.lifecycle:runtime:1.0.0@aar +--- android.arch.lifecycle:common:1.0.0@jar \--- android.arch.core:common:1.0.0@jar debugAndroidTest debugAndroidTestCompileClasspath - Dependencies for compilation +--- com.android.support:appcompat-v7:26.1.0@aar +--- com.android.support:animated-vector-drawable:26.1.0@aar +--- com.android.support:support-vector-drawable:26.1.0@aar +--- com.android.support:support-v4:26.1.0@aar +--- com.android.support:support-media-compat:26.1.0@aar +--- com.android.support:support-fragment:26.1.0@aar +--- com.android.support:support-core-utils:26.1.0@aar +--- com.android.support:support-core-ui:26.1.0@aar +--- com.android.support:support-compat:26.1.0@aar +--- com.android.support:support-annotations:26.1.0@jar +--- android.arch.lifecycle:runtime:1.0.0@aar +--- android.arch.lifecycle:common:1.0.0@jar \--- android.arch.core:common:1.0.0@jar debugAndroidTestRuntimeClasspath - Dependencies for runtime/packaging debugUnitTest debugUnitTestCompileClasspath - Dependencies for compilation +--- com.android.support:appcompat-v7:26.1.0@aar +--- com.android.support:animated-vector-drawable:26.1.0@aar +--- com.android.support:support-vector-drawable:26.1.0@aar +--- com.android.support:support-v4:26.1.0@aar +--- com.android.support:support-media-compat:26.1.0@aar +--- com.android.support:support-fragment:26.1.0@aar +--- com.android.support:support-core-utils:26.1.0@aar +--- com.android.support:support-core-ui:26.1.0@aar +--- com.android.support:support-compat:26.1.0@aar +--- com.android.support:support-annotations:26.1.0@jar +--- android.arch.lifecycle:runtime:1.0.0@aar +--- android.arch.lifecycle:common:1.0.0@jar \--- android.arch.core:common:1.0.0@jar productFlavors等所有debugCompileClasspath都是如此。我是否可以添加过滤器以仅显示debugRuntimeClasspath项目。

1 个答案:

答案 0 :(得分:1)

来自帮助命令./gradlew help --task :app:androidDependencies,我没有找到任何选项,因此任务:app:androidDependencies可能效果不佳。

> Task :help
Detailed task information for :app:androidDependencies

Path
     :app:androidDependencies

Type
     DependencyReportTask (com.android.build.gradle.internal.tasks.DependencyReportTask)

Description
     Displays the Android dependencies of the project.

Group
     Android

./gradlew tasks开始,还有另一个名为app:dependencies的类似任务。它有一个选项。

> Task :help
Detailed task information for app:dependencies

Path
     :app:dependencies

Type
     DependencyReportTask (org.gradle.api.tasks.diagnostics.DependencyReportTask)

Options
     --configuration     The configuration to generate the report for.

Description
     Displays all dependencies declared in project ':app'.

Group
     help 

然后命令./gradlew -q app:dependencies --configuration debugCompileClasspath拯救我的眼睛。