zoukankan      html  css  js  c++  java
  • AS报错:gradle project sync failed

    情形一:

    Android studio下突然报错:

    gradle project sync failed.Basic functionality(e.g.editing,debugging) will not work properly.

    解决方案:进入项目目录下,找到 gradlewrappergradle-wrapper.properties 文件,记事本打开,内容如下:

    Tue Jul 24 14:48:54 CST 2018
    distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists
    distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip
    

    最后一句,https://services.gradle.org/distributions/gradle-4.4-all.zip

    studio会下载上面的Gradle,不知道什么原因下载不下来,我们可以手动下载这个版本的Gradle,无需解压直接拷贝到
    C:UsersAdministrator.gradlewrapperdistsgradle-2.10-all9br9xq1tocpiv8o6njlyu5op1下即可,重启studio,问题解决

    情形二:

    1.拷贝他人的项目,而二者的AS版本不一样,调整自己的SDK版本和SDK工具版本。

    2.AS升级到3.2.1版本后提示:

    Warning:The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum
    supported version (26.0.3) for Android Gradle Plugin 3.0.1. Android SDK Build Tools 26.0.3 will be used. To suppress this warning, remove "buildToolsVersion '26.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
    

    解决方法:

    image.png
    image.png

    框框处改成指定的版本。

    接着,在build.gradle(Project)中修改Gradle版本到3.2.1或更新版本

    如下图:

    image.png

    3.仍旧报错。根据所提示的文件找到Android目录下的该文件

    image.png

    对project下的chat/src/main/res/values-w820dp下的ids.xml修改
    将:
    <item type="id" name="about_version_code">false</item>
    <item type="id" name="split">false</item>
    
    修改成:
    <item type="id" name="about_version_code"/>
    <item type="id" name="split"/>
    
    项目可以成功运行并安装使用!
    The one who wants to wear the crown, bears the crown.
  • 相关阅读:
    一篇文章了解_docker
    一篇文章了解_接口测试
    一篇文章了解_unittest
    一篇文章了解_selenium
    Python命令行参数sys.argv[]
    Python_pycharm调试模式+使用pycharm给python传递参数
    Python_异常处理、调试
    [问答题]写出下列程序的输出结果:
    [单选题]函数的参数传递包括:
    [单选题]PHP函数,mail($param1, $param2, $param3),其中的$param2参数包含什么?
  • 原文地址:https://www.cnblogs.com/catherineliu/p/13049306.html
Copyright © 2011-2022 走看看