Android 自定义 plugin 获取依赖项

获取已解决的依赖项

Collections.UnmodifiableSet set = (Collections.UnmodifiableSet) project
        .getConfigurations()
        .getByName("releaseRuntimeClasspath")
        .getIncoming()
        .getResolutionResult()
        .getRoot()
        .getDependencies();
Iterator iterator = set.iterator();
while (iterator.hasNext()) {
    
    
    DependencyResult next = (DependencyResult) iterator.next();
    //输出
}

获取为解决的依赖项:

Collections.UnmodifiableSet set = (Collections.UnmodifiableSet) project
        .getConfigurations()
        .getByName("releaseRuntimeClasspath")
        .getAllDependencies();

猜你喜欢

转载自blog.csdn.net/qq_27512671/article/details/123735663