简体   繁体   English

Android Studio - Gradle同步错误

[英]Android Studio - Gradle sync error

I have a synchronization error in Android Studio. 我在Android Studio中遇到同步错误。 I Use: 1.0.2 version from canary channel. 我使用:来自金丝雀频道的1.0.2版本。 Gradle : I tried with version 2.2.1(downloaded from https://www.gradle.org/downloads ) and self-download version. Gradle :我尝试使用2.2.1版(从https://www.gradle.org/downloads下载)和自行下载版本。 JDK : jdk1.8.0_05 JDK :jdk1.8.0_05

I created a new project and the error is always the same: 我创建了一个新项目,错误总是一样的: 在此输入图像描述

Error:Unable to find method 'org.objectweb.asm.ClassReader.getMaxStringLength()I'. 错误:无法找到方法'org.objectweb.asm.ClassReader.getMaxStringLength()我'。 Possible causes for this unexpected error include: 此意外错误的可能原因包括:

  • Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Gradle的依赖性缓存可能已损坏(这有时会在网络连接超时后发生。)

  • I tried resolve the issue with the invalidation of cache method , and stopping Gradle daemon , but nothing.. 我尝试使用缓存方法失效解决问题,并停止Gradle守护程序 ,但没有..

    Delete the .gradle directories both in your home directory and at the top level of your project. 删除主目录和项目顶层的.gradle目录。 Gradle's cache directoires aren't affected by the "Clear caches and restart" option. Gradle的缓存直播不受“清除缓存和重启”选项的影响。

    After updating to Android Studio 2.3 I received this error and the top answer didn't work. 更新到Android Studio 2.3后,我收到此错误,但最佳答案无效。 Following an answer from here I finally got it fixed. 这里得到答案后我终于解决了问题。

    Go to

    gradle → wrapper → gradle.wrapper.properties gradle→wrapper→gradle.wrapper.properties

    And change to distributionUrl to the following: 并将distributionUrl更改为以下内容:

    distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip
    

    Sorry for a late answer but I hope it will still be useful. 对不起,迟到的答案,但我希望它仍然有用。 I faced the same problem and deleting .gradle directories didn't help. 我遇到了同样的问题,并删除.gradle目录没有帮助。

    Try to reinstall your JDK. 尝试重新安装JDK。 In my case I uninstalled my JDK 1.7.0_60 (x64) and JDK 1.8.0_5 (x86). 在我的情况下,我卸载了我的JDK 1.7.0_60(x64)和JDK 1.8.0_5(x86)。 Then I installed JDK 1.8.0_45 (x64) and the problem has gone. 然后我安装了JDK 1.8.0_45(x64),问题就消失了。 HTH. HTH。

    声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

     
    粤ICP备18138465号  © 2020-2024 STACKOOM.COM