美文网首页
包冲突依赖分析

包冲突依赖分析

作者: CentForever | 来源:发表于2022-05-25 17:01 被阅读0次

    分析依赖

    常见指令

    • gradlew :app:dependencyInsight --configuration debugCompileClasspath --dependency work-runtime
    • ./gradlew -q :ecabin:dependencyInsight --dependency support-annotations --configuration compile
    • ./gradlew :app:androidDependencies
    • 指令前的:app是你的module名
    • configuration 参数用于指定 variant,例如你还可以传入 releaseCompileClasspath
    ─   ~/AndroidStudioProjects/FileDownloader ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────── at  16:39:12 ─╮
    ╰─❯ ./gradlew :app:dependencyInsight --configuration debugCompileClasspath --dependency work-runtime                                                                            ─╯
    
    > Task :app:dependencyInsight
    No dependencies matching given input were found in configuration ':app:debugCompileClasspath'
    
    BUILD SUCCESSFUL in 1s
    1 actionable task: 1 executed
    
    ╭─   ~/AndroidStudioProjects/FileDownloader ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────── at  16:40:20 ─╮
    ╰─❯ ./gradlew :ecabin:dependencyInsight --configuration debugCompileClasspath --dependency work-runtime                                                                         ─╯
    
    > Task :ecabin:dependencyInsight
    androidx.work:work-runtime:2.7.1
       variant "releaseVariantReleaseApiPublication" [
          org.gradle.category                             = library (not requested)
          org.gradle.dependency.bundling                  = external (not requested)
          org.gradle.libraryelements                      = aar (not requested)
          org.gradle.usage                                = java-api
          org.gradle.status                               = release (not requested)
    
          Requested attributes not found in the selected variant:
             com.android.build.api.attributes.BuildTypeAttr  = debug
             org.gradle.jvm.environment                      = android
             com.android.build.api.attributes.AgpVersionAttr = 7.2.0
       ]
       Selection reasons:
          - By constraint : debugRuntimeClasspath uses version 2.7.1
    
    androidx.work:work-runtime:2.7.1
    \--- debugCompileClasspath
    
    androidx.work:work-runtime:{strictly 2.7.1} -> 2.7.1
    \--- debugCompileClasspath
    
    A web-based, searchable dependency report is available by adding the --scan option.
    
    BUILD SUCCESSFUL in 1s
    1 actionable task: 1 executed
    
    

    注意事项

    • gradle.properties 添加org.gradle.java.home=/Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home

    参考

    QA

    image.png

    相关文章

      网友评论

          本文标题:包冲突依赖分析

          本文链接:https://www.haomeiwen.com/subject/juaeprtx.html