<article class="article fmt article-content" data-id="1190000015805844" data-license="cc">
https://segmentfault.com/a/1190000015805844
一、问题的产生
https://segmentfault.com/a/1190000015805844 这里的1.1 引入的支持库版本和编译版本不一致
相信大家在build.gradle
中引入各种依赖的时候,或多或少会见过一些红线,gradle
会提示你,当前的编译版本和你依赖的这个支持库的版本号不同,应该使用相同的支持库版本,来比避免编译不通过问题,类似于这种。
This support library should not use a different version (27) than the compileSdkVersion (26)
还有连锁反应会出现这种问题:所有的Android支持库
support
版本号要一致,也是避免运行时崩溃的问题。
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 27.1.0, 26.1.0. Examples include com.android.support:recyclerview-v7:27.1.0 and com.android.support:animated-vector-drawable:26.1.0
上面的问题,也可以在Android studio
左侧的Project
栏的External Libraries
中查看,可以看到 由于引入了和当前编译版本号不同的支持库所产生的问题:
1.2 第三方库中的子依赖和当前项目的编译版本不一致。
当引入一个第三方库,该库中也依赖了
Android
支持库,且支持库的版本,和当前版本不一致而导致的版本冲突:
二、如何解决
解决冲突的方式包括:强制指定,排除。
2.1 查看依赖树
Gradle 默认开启了 依赖传递 意思就是 项目依赖了A,A又依赖了B和C,这时候,我们只需要写一行代码:implementation A
就行了,由传递依赖导致的冲突,默认是以最高版本的依赖为准,要想查看整个项目的依赖传递关系,使用命令:
./gradlew app:dependencies --configuration releaseRuntimeClasspath
app
是具体的module
。releaseRuntimeClasspath
是具体的variants
类型。
+--- com.android.support.constraint:constraint-layout:1.1.2
| \--- com.android.support.constraint:constraint-layout-solver:1.1.2
+--- com.android.support:appcompat-v7:26.1.0
| +--- com.android.support:support-annotations:26.1.0 -> 27.1.1
| +--- com.android.support:support-v4:26.1.0
| | +--- com.android.support:support-compat:26.1.0 -> 27.1.1
| | | +--- com.android.support:support-annotations:27.1.1
| | | \--- android.arch.lifecycle:runtime:1.1.0
| | | +--- android.arch.lifecycle:common:1.1.0
| | | \--- android.arch.core:common:1.1.0
| | +--- com.android.support:support-media-compat:26.1.0
| | | +--- com.android.support:support-annotations:26.1.0 -> 27.1.1
| | | \--- com.android.support:support-compat:26.1.0 -> 27.1.1 (*)
| | +--- com.android.support:support-core-utils:26.1.0 -> 27.1.1
| | | +--- com.android.support:support-annotations:27.1.1
| | | \--- com.android.support:support-compat:27.1.1 (*)
| | +--- com.android.support:support-core-ui:26.1.0 -> 27.1.1
| | | +--- com.android.support:support-annotations:27.1.1
| | | +--- com.android.support:support-compat:27.1.1 (*)
| | | \--- com.android.support:support-core-utils:27.1.1 (*)
| | \--- com.android.support:support-fragment:26.1.0 -> 27.1.1
| | +--- com.android.support:support-compat:27.1.1 (*)
| | +--- com.android.support:support-core-ui:27.1.1 (*)
| | +--- com.android.support:support-core-utils:27.1.1 (*)
| | +--- com.android.support:support-annotations:27.1.1
| | +--- android.arch.lifecycle:livedata-core:1.1.0
| | | +--- android.arch.lifecycle:common:1.1.0
| | | +--- android.arch.core:common:1.1.0
| | | \--- android.arch.core:runtime:1.1.0
| | | \--- android.arch.core:common:1.1.0
| | \--- android.arch.lifecycle:viewmodel:1.1.0
| +--- com.android.support:support-vector-drawable:26.1.0
| | +--- com.android.support:support-annotations:26.1.0 -> 27.1.1
| | \--- com.android.support:support-compat:26.1.0 -> 27.1.1 (*)
| \--- com.android.support:animated-vector-drawable:26.1.0
| +--- com.android.support:support-vector-drawable:26.1.0 (*)
| \--- com.android.support:support-core-ui:26.1.0 -> 27.1.1 (*)
+--- com.android.support:recyclerview-v7:26.1.0
| +--- com.android.support:support-annotations:26.1.0 -> 27.1.1
| +--- com.android.support:support-compat:26.1.0 -> 27.1.1 (*)
| \--- com.android.support:support-core-ui:26.1.0 -> 27.1.1 (*)
\--- com.github.bumptech.glide:glide:4.7.1
+--- com.github.bumptech.glide:gifdecoder:4.7.1
| \--- com.android.support:support-annotations:27.1.1
+--- com.github.bumptech.glide:disklrucache:4.7.1
+--- com.github.bumptech.glide:annotations:4.7.1
\--- com.android.support:support-fragment:27.1.1 (*)
符号的含义:
-
x.x.x (*)
该依赖已经有了,将不再重复依赖。 -
x.x.x -> x.x.x
该依赖的版本被箭头所指的版本代替。 -
x.x.x -> x.x.x(*)
该依赖的版本被箭头所指的版本代替,并且该依赖已经有了,不再重复依赖。
2.2 Exclude 排除
排除所有:
// 在build.gradle 中添加下面节点
configuration{
all*.exclude module: "support-fragment"
}
执行结果:(部分)
\--- com.github.bumptech.glide:glide:4.7.1
+--- com.github.bumptech.glide:gifdecoder:4.7.1
| \--- com.android.support:support-annotations:27.1.1
+--- com.github.bumptech.glide:disklrucache:4.7.1
\--- com.github.bumptech.glide:annotations:4.7.1
可以看到相比最开始的执行结果,已经将 glide
的子依赖 com.android.support:support-fragment
排除了。
排除指定:
implementation ('com.github.bumptech.glide:glide:4.7.1'){
exclude module:"support-fragment"
}
执行结果:(部分)
+--- com.android.support:appcompat-v7:26.1.0
| +--- com.android.support:support-annotations:26.1.0 -> 27.1.1
| +--- com.android.support:support-v4:26.1.0
| | +--- com.android.support:support-compat:26.1.0
| | | ...
| | +--- com.android.support:support-media-compat:26.1.0
| | | ...
| | +--- com.android.support:support-core-utils:26.1.0
| | | ...
| | +--- com.android.support:support-core-ui:26.1.0
| | | //不影响该子依赖
| | \--- com.android.support:support-fragment:26.1.0
| | +--- com.android.support:support-compat:26.1.0 (*)
| | +--- com.android.support:support-core-ui:26.1.0 (*)
| | \--- com.android.support:support-core-utils:26.1.0 (*)
| +--- com.android.support:support-vector-drawable:26.1.0
| | ...
| \--- com.android.support:animated-vector-drawable:26.1.0
| ...
+--- com.android.support:recyclerview-v7:26.1.0
| //该依赖的子依赖被排除
\--- com.github.bumptech.glide:glide:4.7.1
+--- com.github.bumptech.glide:gifdecoder:4.7.1
| \--- com.android.support:support-annotations:27.1.1
+--- com.github.bumptech.glide:disklrucache:4.7.1
\--- com.github.bumptech.glide:annotations:4.7.1
可以看到指定排除glide
依赖的子依赖 com.android.support:support-fragment
不影响其他依赖。
exclude 可以搭配group
和module
使用,将会排除所有被匹配的依赖。
2.3 Force 强制指定
强制指定依赖的版本。
configurations.all {
resolutionStrategy {
force 'com.android.support:support-fragment:26.1.0'
}
}
执行结果(部分):
+--- com.android.support:appcompat-v7:26.1.0
| ...
| +--- com.android.support:support-v4:26.1.0
| | +--- com.android.support:support-compat:26.1.0
| | | ...
| | +--- com.android.support:support-media-compat:26.1.0
| | | ...
| | +--- com.android.support:support-core-utils:26.1.0
| | | ...
| | +--- com.android.support:support-core-ui:26.1.0
| | | //该依赖被强制指定了版本号
| | \--- com.android.support:support-fragment:26.1.0
| | +--- com.android.support:support-compat:26.1.0 (*)
| | +--- com.android.support:support-core-ui:26.1.0 (*)
| | \--- com.android.support:support-core-utils:26.1.0 (*)
| +--- com.android.support:support-vector-drawable:26.1.0
| | ...
| \--- com.android.support:animated-vector-drawable:26.1.0
| ...
+--- com.android.support:recyclerview-v7:26.1.0
| ...
\--- com.github.bumptech.glide:glide:4.7.1
+--- com.github.bumptech.glide:gifdecoder:4.7.1
| \--- com.android.support:support-annotations:27.1.1
+--- com.github.bumptech.glide:disklrucache:4.7.1
+--- com.github.bumptech.glide:annotations:4.7.1
//强制指定了版本号
\--- com.android.support:support-fragment:27.1.1 -> 26.1.0 (*)
写的匆忙,如有纰漏,还望指正,如果不小心绑到了你,那真是极好的,今天顺便google了一下,如何查看具体的某一个依赖的情况,但是一直没有头绪,使用了dependencyInsight
命令也不行。 如果有知道的希望可以交流一下。 谢谢。
</article>
<script type="text/javascript">
OA_show(3);
</script><div id="OA_holder_3"><div class="d-none d-lg-flex justify-content-center">
<div class="text-secondary font-size-14 mt-3 mb-5 d-flex justify-content-between row">
<div class="col-6 text-secondary" id="sf-article_metas" data-viewsword="10782">阅读 10.8k<span class="split-dot"></span><time datetime="2018-07-29T16:45:26+08:00" itemprop="datePublished">发布于 2018-07-29 </time></div>
<div class="operation col-6 text-right">
</div>
</div>
<div class="functional-area-bottom"><div class="text-center"><div class="btn-group like-group mr-2" role="group">
<button data-type="question" class="func-btn mainLike like-btn btn btn-outline-primary
" data-id="1190000015805844">
<svg class="svg-inline--fa fa-thumbs-up fa-w-16" aria-hidden="true" focusable="false" data-prefix="far" data-icon="thumbs-up" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" data-fa-i2svg=""><path fill="currentColor" d="M466.27 286.69C475.04 271.84 480 256 480 236.85c0-44.015-37.218-85.58-85.82-85.58H357.7c4.92-12.81 8.85-28.13 8.85-46.54C366.55 31.936 328.86 0 271.28 0c-61.607 0-58.093 94.933-71.76 108.6-22.747 22.747-49.615 66.447-68.76 83.4H32c-17.673 0-32 14.327-32 32v240c0 17.673 14.327 32 32 32h64c14.893 0 27.408-10.174 30.978-23.95 44.509 1.001 75.06 39.94 177.802 39.94 7.22 0 15.22.01 22.22.01 77.117 0 111.986-39.423 112.94-95.33 13.319-18.425 20.299-43.122 17.34-66.99 9.854-18.452 13.664-40.343 8.99-62.99zm-61.75 53.83c12.56 21.13 1.26 49.41-13.94 57.57 7.7 48.78-17.608 65.9-53.12 65.9h-37.82c-71.639 0-118.029-37.82-171.64-37.82V240h10.92c28.36 0 67.98-70.89 94.54-97.46 28.36-28.36 18.91-75.63 37.82-94.54 47.27 0 47.27 32.98 47.27 56.73 0 39.17-28.36 56.72-28.36 94.54h103.99c21.11 0 37.73 18.91 37.82 37.82.09 18.9-12.82 37.81-22.27 37.81 13.489 14.555 16.371 45.236-5.21 65.62zM88 432c0 13.255-10.745 24-24 24s-24-10.745-24-24 10.745-24 24-24 24 10.745 24 24z"></path></svg><!-- <i class="far fa-thumbs-up"></i> -->
<span class="ml-1">赞</span> <span class="mainLikeNum">3</span>
</button></div><button class="func-btn mainBookmark btn btn-outline-secondary
mr-2 " data-id="1190000015805844">
<svg class="svg-inline--fa fa-bookmark fa-w-12" aria-hidden="true" focusable="false" data-prefix="far" data-icon="bookmark" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" data-fa-i2svg=""><path fill="currentColor" d="M336 0H48C21.49 0 0 21.49 0 48v464l192-112 192 112V48c0-26.51-21.49-48-48-48zm0 428.43l-144-84-144 84V54a6 6 0 0 1 6-6h276c3.314 0 6 2.683 6 5.996V428.43z"></path></svg><!-- <i class="far fa-bookmark"></i> -->
<span class="ml-1">收藏</span> <span class="bookmarkNum">2</span>
</button><div class="dropdown dropup d-inline-block">
<button class="func-btn btn btn-outline-secondary
" id="func_share" data-toggle="dropdown">
<svg class="svg-inline--fa fa-share-alt fa-w-14" aria-hidden="true" focusable="false" data-prefix="far" data-icon="share-alt" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" data-fa-i2svg=""><path fill="currentColor" d="M352 320c-25.6 0-48.9 10-66.1 26.4l-98.3-61.5c5.9-18.8 5.9-39.1 0-57.8l98.3-61.5C303.1 182 326.4 192 352 192c53 0 96-43 96-96S405 0 352 0s-96 43-96 96c0 9.8 1.5 19.6 4.4 28.9l-98.3 61.5C144.9 170 121.6 160 96 160c-53 0-96 43-96 96s43 96 96 96c25.6 0 48.9-10 66.1-26.4l98.3 61.5c-2.9 9.4-4.4 19.1-4.4 28.9 0 53 43 96 96 96s96-43 96-96-43-96-96-96zm0-272c26.5 0 48 21.5 48 48s-21.5 48-48 48-48-21.5-48-48 21.5-48 48-48zM96 304c-26.5 0-48-21.5-48-48s21.5-48 48-48 48 21.5 48 48-21.5 48-48 48zm256 160c-26.5 0-48-21.5-48-48s21.5-48 48-48 48 21.5 48 48-21.5 48-48 48z"></path></svg><!-- <i class="far fa-share-alt"></i> -->
<span class="ml-1 show-row">分享</span>
</button>
<div class="dropdown-menu shareContent" aria-labelledby="func_share">
<div class="text-center mt-2" style="cursor: auto">
<div class="qr"><img crossorigin="anonymous" src="https://img-blog.csdnimg.cn/2022010700423599979.png" width="236" height="236" style="width: 118px; height: 118px;"></div>
扫一扫分享
</div>
<div class="dropdown-divider"></div>
<a class="dropdown-item share_weibo" data-share="weibo" href="http://weibo.com/segmentfault" target="_blank"><svg class="svg-inline--fa fa-weibo fa-w-16 fa-fw" aria-hidden="true" focusable="false" data-prefix="fab" data-icon="weibo" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" data-fa-i2svg=""><path fill="currentColor" d="M407 177.6c7.6-24-13.4-46.8-37.4-41.7-22 4.8-28.8-28.1-7.1-32.8 50.1-10.9 92.3 37.1 76.5 84.8-6.8 21.2-38.8 10.8-32-10.3zM214.8 446.7C108.5 446.7 0 395.3 0 310.4c0-44.3 28-95.4 76.3-143.7C176 67 279.5 65.8 249.9 161c-4 13.1 12.3 5.7 12.3 6 79.5-33.6 140.5-16.8 114 51.4-3.7 9.4 1.1 10.9 8.3 13.1 135.7 42.3 34.8 215.2-169.7 215.2zm143.7-146.3c-5.4-55.7-78.5-94-163.4-85.7-84.8 8.6-148.8 60.3-143.4 116s78.5 94 163.4 85.7c84.8-8.6 148.8-60.3 143.4-116zM347.9 35.1c-25.9 5.6-16.8 43.7 8.3 38.3 72.3-15.2 134.8 52.8 111.7 124-7.4 24.2 29.1 37 37.4 12 31.9-99.8-55.1-195.9-157.4-174.3zm-78.5 311c-17.1 38.8-66.8 60-109.1 46.3-40.8-13.1-58-53.4-40.3-89.7 17.7-35.4 63.1-55.4 103.4-45.1 42 10.8 63.1 50.2 46 88.5zm-86.3-30c-12.9-5.4-30 .3-38 12.9-8.3 12.9-4.3 28 8.6 34 13.1 6 30.8.3 39.1-12.9 8-13.1 3.7-28.3-9.7-34zm32.6-13.4c-5.1-1.7-11.4.6-14.3 5.4-2.9 5.1-1.4 10.6 3.7 12.9 5.1 2 11.7-.3 14.6-5.4 2.8-5.2 1.1-10.9-4-12.9z"></path></svg><!-- <i class="fab fa-weibo fa-fw"></i> --> 新浪微博</a><a class="dropdown-item share_twitter" data-share="twitter" href="https://twitter.com/segment_fault" target="_blank"><svg class="svg-inline--fa fa-twitter fa-w-16 fa-fw" aria-hidden="true" focusable="false" data-prefix="fab" data-icon="twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" data-fa-i2svg=""><path fill="currentColor" d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"></path></svg><!-- <i class="fab fa-twitter fa-fw"></i> --> Twitter</a><a class="dropdown-item share_facebook" data-share="facebook" href="javascript:;" target="_blank"><svg class="svg-inline--fa fa-facebook-square fa-w-14 fa-fw" aria-hidden="true" focusable="false" data-prefix="fab" data-icon="facebook-square" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" data-fa-i2svg=""><path fill="currentColor" d="M400 32H48A48 48 0 0 0 0 80v352a48 48 0 0 0 48 48h137.25V327.69h-63V256h63v-54.64c0-62.15 37-96.48 93.67-96.48 27.14 0 55.52 4.84 55.52 4.84v61h-31.27c-30.81 0-40.42 19.12-40.42 38.73V256h68.78l-11 71.69h-57.78V480H400a48 48 0 0 0 48-48V80a48 48 0 0 0-48-48z"></path></svg><!-- <i class="fab fa-facebook-square fa-fw"></i> --> Facebook</a></div>
</div></div></div>
<div class="text-center mb-5 mt-3 text-secondary font-size-14">
本作品系
原创
,
<a target="_blank" class="text-secondary" href="https://creativecommons.org/licenses/by-nc-nd/4.0/">采用《署名-非商业性使用-禁止演绎 4.0
国际》许可协议</a>
</div>
<hr class="mb-0">
<div class="article-author d-flex flex-sm-row align-items-center pt-4 row">
<div class="d-flex align-items-center flex-grow-1 author-left col-sm-9 col-12">
<a href="/u/gushu">
<img class="rounded-circle mr-3" width="64" src="https://avatar-static.segmentfault.com/424/554/4245542841-582c1fa358ff6_big64" aria-hidden="true">
</a>
<div>
<h5><a class="text-body" href="/u/gushu">大尾巴狼</a></h5>
<ul class="list-inline mb-0 authentication-info">
<li class="list-inline-item">
<svg class="svg-inline--fa fa-dice-d8 fa-w-16" style="color: #BF7158;" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="dice-d8" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" data-fa-i2svg=""><path fill="currentColor" d="M225.53 2.52L2.36 233.83c-4.21 4.37-2.56 11.71 3.1 13.77l234.13 85.06V8.39c-.01-7.49-8.91-11.21-14.06-5.87zm284.11 231.31L286.47 2.52C281.32-2.82 272.41.9 272.41 8.4v324.27l234.13-85.06c5.66-2.07 7.31-9.42 3.1-13.78zM33.53 310.38l192 199.1c5.15 5.34 14.06 1.62 14.06-5.88V368.29L42.13 296.61c-8.21-2.98-14.72 7.43-8.6 13.77zm436.34-13.77l-197.46 71.68V503.6c0 7.5 8.91 11.22 14.06 5.88l192-199.1c6.12-6.34-.39-16.75-8.6-13.77z"></path></svg><!-- <i class="fas fa-dice-d8" style="color:#BF7158"></i> -->
<span style="color: #BF7158; font-size:16px; font-weight:bold">243</span>
</li>
</ul>
</div>
</div>
<div class="author-right flex-shrink-0 col-sm-3 col-12 text-sm-right text-left mt-sm-0 mt-3">
<button type="button" class="btn btn-primary follow-user sf_do" data-dotype="post" data-content="{"type":"state","state":false,"true":"\u5173\u6ce8\u4f5c\u8005","false":"\u6b63\u5728\u5173\u6ce8"}" data-api="/iteration/api/user/1030000007499674/follow">关注作者
</button>
</div>
</div>
</div>
</div>
<div id="comment-area" class="my-4" data-type="article" data-id="1190000015805844" data-page="1" data-user="{"avatarUrl":"https:\/\/cdn.segmentfault.com\/v-5f0a9217\/global\/img\/user-64.png"}"><div class="d-flex justify-content-between mb-2">
<div id="comment-total" class="h5 mb-0">1 条评论</div>
<div>
<a href="javascript:;" class="sort text-dark" data-sort="default">得票</a><span class="split-dot"></span><a href="javascript:;" class="sort text-secondary" data-sort="desc">时间</a>
</div>
</div><div class="card border-0">
<div class="card-body">
<div class="media">
<img src="https://cdn.segmentfault.com/v-5f0a9217/global/img/user-64.png" class="rounded-circle mr-3" width="38" aria-hidden="true">
<form class="media-body" action="/api/article/1190000015805844/comments/add">
<div class="form-group">
<textarea autoheight="true" class="form-control comment-text" rows="1" placeholder="撰写评论 ..." style="overflow: hidden; overflow-wrap: break-word; resize: none; height: 38px;" name="text"></textarea>
</div>
<div class="d-flex justify-content-end">
<button data-js-replay-submit-btn="" type="button" submit-type="comment" class="btn btn-primary float-right" disabled="">提交评论</button>
<input type="hidden" name="objectId" value="1190000015805844" autocomplete="off">
</div>
</form>
</div>
<div id="comment-body"><div class="media mb-4" id="comment-1050000017323090">
<img class="d-block rounded-circle mr-3" width="38" height="38" src="https://cdn.segmentfault.com/v-5f0a9217/global/img/user-64.png" alt="">
<div class="media-body w-0">
<div class="commentUnit">
<div class="mb-2">
<a class="d-uname" href="/u/dingypgit" target="_blank"><strong>dingypgit</strong></a>
:
<div class="parsedText fmt">
configuration{
all*.exclude module: "support-fragment"
} ==> configurations 少了个S
<form class="d-none edit-form edit-top-comment-form" action="/api/comment/1050000017323090/edit" method="post">
<div class="form-group">
<textarea autoheight="true" class="form-control comment-text" rows="1" placeholder="撰写评论 ..." style="overflow: hidden; overflow-wrap: break-word; resize: none;" name="text" data-init="configuration{
all*.exclude module: "support-fragment"
} ==> configurations 少了个S">
取消
提交
<div class="handle-bar font-size-14 d-flex justify-content-between">
<div>
<a class="text-secondary" href="javascript:;">
<span class="mainLike-comment " data-id="1050000017323090">
<svg class="svg-inline--fa fa-thumbs-up fa-w-16 mr-1" aria-hidden="true" focusable="false" data-prefix="far" data-icon="thumbs-up" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" data-fa-i2svg=""><path fill="currentColor" d="M466.27 286.69C475.04 271.84 480 256 480 236.85c0-44.015-37.218-85.58-85.82-85.58H357.7c4.92-12.81 8.85-28.13 8.85-46.54C366.55 31.936 328.86 0 271.28 0c-61.607 0-58.093 94.933-71.76 108.6-22.747 22.747-49.615 66.447-68.76 83.4H32c-17.673 0-32 14.327-32 32v240c0 17.673 14.327 32 32 32h64c14.893 0 27.408-10.174 30.978-23.95 44.509 1.001 75.06 39.94 177.802 39.94 7.22 0 15.22.01 22.22.01 77.117 0 111.986-39.423 112.94-95.33 13.319-18.425 20.299-43.122 17.34-66.99 9.854-18.452 13.664-40.343 8.99-62.99zm-61.75 53.83c12.56 21.13 1.26 49.41-13.94 57.57 7.7 48.78-17.608 65.9-53.12 65.9h-37.82c-71.639 0-118.029-37.82-171.64-37.82V240h10.92c28.36 0 67.98-70.89 94.54-97.46 28.36-28.36 18.91-75.63 37.82-94.54 47.27 0 47.27 32.98 47.27 56.73 0 39.17-28.36 56.72-28.36 94.54h103.99c21.11 0 37.73 18.91 37.82 37.82.09 18.9-12.82 37.81-22.27 37.81 13.489 14.555 16.371 45.236-5.21 65.62zM88 432c0 13.255-10.745 24-24 24s-24-10.745-24-24 10.745-24 24-24 24 10.745 24 24z"></path></svg><!-- <i class="far fa-thumbs-up mr-1"></i> -->
</span>
<span data-icon-count-size="" data-count-hidden="true" class="mainLike-commentNum">
1</span>
</a>
<span class="split-dot"></span>
<a class="text-secondary btn-comment" href="javascript:;" data-id="1050000017323090">回复</a>
<span class="split-dot"></span>
<span class="ml-1 text-secondary">2018-12-10 </span>
</div>
<div class="control-area d-none">
<a class="text-secondary comment-report" href="javascript:;" data-dotype="modal" data-content="{'type':'form','asyncUrl':'/iteration/api/reason/comment/report?id=1050000017323090','data':null}" data-api="/iteration/api/comment/1050000017323090/report">举报</a>
</div>
</div>
<div class="card bg-light border-0 mt-2 d-none" id="comment-1050000017323090-form">
<form class="card-body my-2 add-comment-form py-0 pt-3" action="/api/comment/1050000017323090/reply" method="post">
<div class="form-group">
<textarea autoheight="true" class="form-control form-control-sm comment-text" rows="1" placeholder="撰写评论 ..." style="overflow: hidden; overflow-wrap: break-word; resize: none;" name="text" aria-placeholder="撰写评论..."></textarea>
</div>
<div class="mt-y d-flex align-content-center justify-content-end">
<button type="button" submit-type="reply" class="btn btn-primary btn-sm" data-commentid="1050000017323090">
提交评论
</button>
<input type="hidden" name="objectId" value="1050000017323090" autocomplete="off">
<input type="hidden" name="replyUserId" value="1030000017323071" autocomplete="off">
</div>
</form>
</div>
</div>
<div class="replies">
<div class="card bg-light border-0 mt-2">
<div class="card-body py-0" style="min-height:0">
<ul class="list-group list-group-flush reply-list" data-page="1">
</ul>
</div>
</div></div>
</div>
</div></div><div class="sflex-center comment-pagination"></div>
</div>
</div></div>
<h5 class="mt-4">推荐阅读</h5>
<div class="card border-0 mb-4">
<div class="list-group list-group-flush" id="paradigm-article-related"></div>
</div>
</div>
<div class="col-12 col-xl-auto">
<div class="w-xl-300">
<div class="blog card mb-4 border-0">
<div class="card-body">
<div class="d-flex align-items-center mb-3">
<div class="media-avatar rounded mr-3" aria-hidden="true"></div>
<div style="flex:1">
<h5><a class="text-body" href="/blog/gushu">古树</a></h5>
<span class="badge badge-primary" style="background-color: #007bff">用户专栏</span>
</div>
</div>
<p class="text-secondary text-truncate-2">进无止境!</p>
<div class="d-flex mb-3">
<div class="mr-4">
<strong id="blog-followers-count" class="followNum">1</strong>
<span class="text-secondary">人关注</span>
</div>
<div>
<strong>5</strong>
<span class="text-secondary">篇文章</span>
</div>
</div>
<div class="d-flex">
<button type="button" class="btn btn-primary mr-2 sf_do" data-number-tag-class="followNum" data-dotype="post" data-content="{"type":"state","state":false,"true":"\u5173\u6ce8\u4e13\u680f","false":"\u6b63\u5728\u5173\u6ce8"}" data-api="/iteration/api/blog/1200000007500397/follow">关注专栏
</button>
<a class="btn btn-outline-primary" href="/blog/gushu">专栏主页</a>
</div>
</div>
</div><div></div>
<!-- / 专栏信息 -->
<div id="first-ad" class="card border-0 overflow-hidden d-none d-xl-flex justify-content-center align-items-center float-ads mb-4" style="top: auto; margin-top: auto; width: 300px;">
<script type="text/javascript">
OA_show(1);
</script><div id="OA_holder_1"><div style="line-height: 0"><div class="ad-close" style="position: relative;"><a href="https://sponsor.segmentfault.com/ck.php?oaparams=2__bannerid=326__zoneid=1__cb=a5c102392a__oadest=https%3A%2F%2Fwww.jetbrains.com%2Fzh-cn%2Fstore%2Fstartups%2F%3Futm_source%3DSegmentFault%26utm_medium%3Dcpc%26utm_campaign%3Dstartupoffer" target="_blank"><img src="https://sponsor-static.segmentfault.com/8847e35c8c2327672fd30aefb4354d41.png" width="300" height="250" alt="" title="" border="0"></a><div id="beacon_a5c102392a" style="position: absolute; left: 0px; top: 0px; visibility: hidden;"><img src="https://sponsor.segmentfault.com/lg.php?bannerid=326&campaignid=83&zoneid=1&loc=https%3A%2F%2Fsegmentfault.com%2Fa%2F1190000015805844&referer=https%3A%2F%2Fsegmentfault.com%2Fa%2F1190000015805844&cb=a5c102392a" width="0" height="0" alt="" style="width: 0px; height: 0px;"></div><div class="sflex-center ad-close-div" style="width: 16px; height: 16px; position: absolute; right: 8px; top: 8px; background-color: rgba(0, 0, 0, 0.75); cursor: pointer; pointer-events: none; border-radius: 50%;"><span class="ad-close-span" style="width: 8px; height: 8px; display: block; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath fill='%23FFF' fill-rule='evenodd' d='M6.6667 0L8 1.3333 5.333 4 8 6.6667 6.6667 8 4 5.333 1.3333 8 0 6.6667 2.666 4 0 1.3333 1.3333 0 4 2.667 6.6667 0z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: center center; pointer-events: auto;"></span></div></div></div>
<div class="card border-0 d-none d-xl-flex mb-4">
<div class="card-body">
<div class="text-center mb-3">
<div class="mb25 hidden-md hidden-sm hidden-xs">
<img src="https://cdn.segmentfault.com/sponsor/20200713.png" alt="Planets" usemap="#gridsMap" width="255" height="136">
<map name="gridsMap" id="gridsMap"><area shape="rect" target="_blank" onmouseover="SFGridAd.d(this)" onmouseout="SFGridAd.e(this)" onclick="SFGridAd.c(1750000022197859)" coords="238,119,255,136" href="/sponsor/1750000022197859/redirect" stitle="萌搜 小众搜索引擎"><area shape="rect" target="_blank" onmouseover="SFGridAd.d(this)" onmouseout="SFGridAd.e(this)" onclick="SFGridAd.c(1750000022831024)" coords="0,119,17,136" href="/sponsor/1750000022831024/redirect" stitle="【酷玩蚊仔】bilibili野生技术协会的宝藏UP主~"><area shape="rect" target="_blank" onmouseover="SFGridAd.d(this)" onmouseout="SFGridAd.e(this)" onclick="SFGridAd.c(1750000023041012)" coords="136,51,170,68" href="/sponsor/1750000023041012/redirect" stitle="ICP/DEI备案代办"><area shape="rect" target="_blank" onmouseover="SFGridAd.d(this)" onmouseout="SFGridAd.e(this)" onclick="SFGridAd.c(1750000023045700)" coords="119,17,170,34" href="/sponsor/1750000023045700/redirect" stitle="低代码开发平台: 开发人员早日脱离996"><area shape="rect" target="_blank" onmouseover="SFGridAd.d(this)" onmouseout="SFGridAd.e(this)" onclick="SFGridAd.c(1750000023052908)" coords="85,68,119,85" href="/sponsor/1750000023052908/redirect" stitle="我们也是0代码编程"><area shape="rect" target="_blank" onmouseover="SFGridAd.d(this)" onmouseout="SFGridAd.e(this)" onclick="SFGridAd.c(1750000023077703)" coords="51,102,187,136" href="/sponsor/1750000023077703/redirect" stitle="思否开源项目支持计划启动,为你的开源项目助力!"><area shape="rect" target="_blank" onmouseover="SFGridAd.d(this)" onmouseout="SFGridAd.e(this)" onclick="SFGridAd.c(1750000023080137)" coords="238,0,255,17" href="/sponsor/1750000023080137/redirect" stitle="手写js,提升前端基础,欢迎pr!"><area shape="rect" target="_blank" onmouseover="SFGridAd.d(this)" onmouseout="SFGridAd.e(this)" onclick="SFGridAd.c(1750000023090846)" coords="34,17,51,34" href="/sponsor/1750000023090846/redirect" stitle="格子广告好有趣😁,交个朋友?"><area shape="rect" target="_blank" onmouseover="SFGridAd.d(this)" onmouseout="SFGridAd.e(this)" onclick="SFGridAd.c(1750000023129987)" coords="238,17,255,51" href="/sponsor/1750000023129987/redirect" stitle="寻优质项目,限时免费对接5-20位投资人"><area shape="rect" target="_blank" onmouseover="SFGridAd.d(this)" onmouseout="SFGridAd.e(this)" onclick="SFGridAd.c(1750000023141453)" coords="221,17,238,51" href="/sponsor/1750000023141453/redirect" stitle="寻优质项目,限时免费对接5-20位投资人"></map>
<div style="text-align: center;"><a style="color:#9E9E9E; font-size:12px" href="/sponsor">广告位促销,月曝光三千万,10 元/天</a></div>
<script async="" src="https://cdn.segmentfault.com/sponsor/20200713.js"></script>
<div class="side-promote-link">
<script type="text/javascript">
OA_show(7);
OA_show(9);
OA_show(10);
OA_show(15);
OA_show(16);
</script><div id="OA_holder_7"><a href="https://sponsor.segmentfault.com/ck.php?oaparams=2__bannerid=314__zoneid=7__cb=c8a598bba2__oadest=https%3A%2F%2Fwww.ucloud.cn%2Fsite%2Fglobal.html%3Fytag%3D%25E5%2587%25BA%25E6%25B5%25B7_sifou_ad" target="_blank"><b>UCloud海外云服务器,1折起 🔥</b><br>
香港CN2·GIA,2核4G 450元/年
<div class="card border-0 overflow-hidden d-none d-xl-flex mb-4 mt-4" data-article-nav="" style="top: auto; margin-top: auto; width: 300px;">
<div class="card-body py-3">
<h6 class="nav-header py-1 mb-0 position-relative bg-white collapsed" style="" for="collapseTarget" data-toggle="collapse" href="#collapseTarget" aria-expanded="false" aria-controls="collapseTarget">
<span class="right">▶</span>
<span class="down hidden">▼</span>
目录
</h6>
<div class="collapse" id="collapseTarget">
<nav id="article-nav-list" data-article-nav-list="" class="font-size-14">
<a class="nav-link text-secondary p-0 my-1 text-truncate" href="#item-1" data-offsettop="0">一、问题的产生</a><a class="nav-link text-secondary py-0 pr-0 my-1 text-truncate" href="#item-1-1" data-offsettop="0">1.1 引入的支持库版本和编译版本不一致</a><a class="nav-link text-secondary py-0 pr-0 my-1 text-truncate" href="#item-1-2" data-offsettop="0">1.2 第三方库中的子依赖和当前项目的编译版本不一致。</a><a class="nav-link text-secondary p-0 my-1 text-truncate" href="#item-2" data-offsettop="0">二、如何解决</a><a class="nav-link text-secondary py-0 pr-0 my-1 text-truncate" href="#item-2-3" data-offsettop="0">2.1 查看依赖树</a><a class="nav-link text-secondary py-0 pr-0 my-1 text-truncate" href="#item-2-4" data-offsettop="0">2.2 Exclude 排除</a><a class="nav-link text-secondary py-0 pr-0 my-1 text-truncate" href="#item-2-5" data-offsettop="0">2.3 Force 强制指定</a></nav>
</div>
</div>
</div>
<!-- / 目录 -->
<div id="second-ad" class="card border-0 overflow-hidden d-none d-xl-flex justify-content-center align-items-center" style="top: auto; margin-top: auto; width: 300px;">
<script type="text/javascript">
OA_show(31);
</script><div id="OA_holder_31"><a href="https://sponsor.segmentfault.com/ck.php?oaparams=2__bannerid=322__zoneid=31__cb=139856ba8b__oadest=https%3A%2F%2Fsegmentfault.com%2Fa%2F1190000020336555" target="_blank"><img src="https://sponsor-static.segmentfault.com/86a060293605188fd8ff27a17ec0750e.png" width="300" height="100" alt="segmentfault_sudo" title="segmentfault_sudo" border="0"></a><div id="beacon_139856ba8b" style="position: absolute; left: 0px; top: 0px; visibility: hidden;"><img src="https://sponsor.segmentfault.com/lg.php?bannerid=322&campaignid=84&zoneid=31&loc=https%3A%2F%2Fsegmentfault.com%2Fa%2F1190000015805844&referer=https%3A%2F%2Fsegmentfault.com%2Fa%2F1190000015805844&cb=139856ba8b" width="0" height="0" alt="" style="width: 0px; height: 0px;"></div>