AS Gradle构建失败异常:Could not download gradle.jar (io.fabric.tools:gradle:1.25.4)

Android Studio 项目Gradle构建失败异常一:报错如下:

Error:A problem occurred configuring project ':app'.>
 Could not resolve all dependencies for configuration ':app:classpath'.>
 Could not download gradle.jar (io.fabric.tools:gradle:1.25.4)> 
 Could not get resource 'https://maven.fabric.io/public/io/fabric/tools/gradle/1.25.4/gradle-1.25.4.jar'.> Connection reset

解决方案:通常原因是电脑的防火墙检查并关闭电脑的防火墙设置

Android Studio 项目Gradle构建失败异常二:报错如下:

Error:A problem occurred configuring project ':app'.>
 Configuration 'compile' is obsolete and has been replaced with 'implementation'. It will be removed at the end of 2018
  1. 解决方案:
    compile会被在2018年底取消,被api替代成implementation,所以会报这 个警告,解决警告的方式就是换成api就好了。

    即:gradle中的compile 换成 implementation 即可。

    以此类推:

    androidTestApi 替换为 androidTestImplementation。
    androidTestCompile 替换为 androidTestImplementation
    testApi 替换为 testImplementation
    testCompile 替换为 testImplementation
    debugCompile 替换为 debugImplementation
    releaseCompile 替换为 releaseImplementation
    所有的api替换为右边的新api,再编辑警告即可解除。
    
  2. 关于compile与implementation的区别:
    compile:可以传递依赖引用,编译时间相对来说长久一些。
    implementation:不可传递依赖引用,比如,B依赖A,C再依赖B,C却不能依赖A的引用或者依赖。当然他的编译时间就会短一些。
    即功能相同,只是在编译上作了一些优化。

猜你喜欢

转载自blog.csdn.net/wjj1996825/article/details/80292828