Could not determine the dependencies of task ':app:preOnlineDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:onlineDebugRuntimeClasspath'.
> Could not find :unspecified:. Searched in the following locations:
- file:/D:/xxxxxxx/xxxxxxx/libs/baseRes/libs/unspecified.jar
Required by: project :app > project :modules:mainpage > com.sobot.chat:sobotsupport-glidev4:1.0.10 > com.sobot.chat:sobotsdk-imageloader:1.0.4
Possible solution: - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
編譯報(bào)錯(cuò)信息如上,讓人實(shí)在摸不著頭腦堪侯。
問題復(fù)現(xiàn):
由于C盤空間告警,所以刪除了gradle的緩存目錄荔仁,然后再編譯項(xiàng)目就會(huì)報(bào)上面的錯(cuò)誤伍宦,試過很多解決辦法,都不見效乏梁,網(wǎng)上也沒有搜索到類似問題的解決辦法次洼,非常玄乎兄弟~
image
問題分析:
可以看到問題最終指向的是這個(gè)SDK,解決辦法就從這里入手遇骑!
com.sobot.chat:sobotsdk-imageloader:1.0.4
SDK內(nèi)部情況如下圖卖毁,很簡單,只有一個(gè)抽象類落萎,那我們在引入智齒SDK的時(shí)候亥啦,把這個(gè)SDK排除掉,同時(shí)把這個(gè)類替換一下练链,不就OK了嗎翔脱?NICE~
image
解決問題:
第一步:排除引入。
image
第二步:編寫自己的?SobotImageLoader.java 類媒鼓。實(shí)際上就是復(fù)制一份届吁,注意保持包名類名的一致。
image
第三步:初始化(加載)這個(gè)類绿鸣。其實(shí)這一步也可以不要疚沐,提前加載只是為了確保類在使用的時(shí)候被加載到虛擬里,保持代碼健壯性潮模。這里最好在?Application 里面操作恬口。
image
總結(jié):
通過測試师逸,以上處理方式能解決這個(gè)奇葩BUG爷恳。這里記錄一下,希望大家碰到類似問題能有個(gè)參考晾剖,同時(shí)也希望各位能有更好的解決方式锉矢,留言我們可以一起交流一下~
Guys梯嗽,Peace & Love