android 添加依赖出现Failed to resolve:"你添加的依赖名" 或者出现 debug@Compileclasspath问题...

Error:Unable to resolve dependency for ':app@debug/compileClasspath': Could not download okhttp.jar (com.squareup.okhttp3:okhttp:3.9.0)

<a href="openFile:D:/MyProjects/CXSmartCommunity/app/build.gradle">Open File</a><br><a href="Unable to resolve dependency for &#39;:app@debug/compileClasspath&#39;: Could not download okhttp.jar (com.squareup.okhttp3:okhttp:3.9.0)">Show Details</a>


解决方案:在整个工程的build.gradle中添加以下框内框内代码:


13032371-5d84d34d2fa4ed14.png

为了大家复制方便直接贴下添加的代码:

allprojects{

    repositories{

        jcenter()

        maven {

url"https://jitpack.io"

        }

    }

}

后来在app下的build.gradle  android{}中添加:

aaptOptions{cruncherEnabled =false   

 useNewCruncher =false}

ok了

猜你喜欢

转载自blog.csdn.net/weixin_33910759/article/details/87360499
今日推荐