Android Studio - Gradle sync error

陌路散爱 提交于 2019-12-17 18:38:52

问题


I have a synchronization error in Android Studio. I Use: 1.0.2 version from canary channel. Gradle: I tried with version 2.2.1(downloaded from https://www.gradle.org/downloads) and self-download version. 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'. Possible causes for this unexpected error include:

  • Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
  • I tried resolve the issue with the invalidation of cache method, and stopping Gradle daemon, but nothing..


    回答1:


    Delete the .gradle directories both in your home directory and at the top level of your project. Gradle's cache directoires aren't affected by the "Clear caches and restart" option.




    回答2:


    After updating to Android Studio 2.3 I received this error and the top answer didn't work. Following an answer from here I finally got it fixed.

    Go to

    gradle → wrapper → gradle.wrapper.properties

    And change to distributionUrl to the following:

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



    回答3:


    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.

    Try to reinstall your JDK. In my case I uninstalled my JDK 1.7.0_60 (x64) and JDK 1.8.0_5 (x86). Then I installed JDK 1.8.0_45 (x64) and the problem has gone. HTH.



    来源:https://stackoverflow.com/questions/27770909/android-studio-gradle-sync-error

    易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
    该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!