17

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: enter image description here

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..

    Nicolas Bortolotti
    • 555
    • 1
    • 8
    • 22
    • I've noticed even on the 1.2 preview canary and other previous versions that periodically I have to resync my project with gradle files manually because it doesn't update when i make a change to a file. This only seems to happen after I Push or pull from git. Wish they would fix this. – JPM Mar 17 '15 at 20:02
    • Do we need to download `gradle` ? – Bunny Jul 17 '15 at 12:18

    3 Answers3

    27

    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.

    Scott Barta
    • 79,344
    • 24
    • 180
    • 163
    • Scott, I already deleted both directories. But still exist the sync error. other idea? – Nicolas Bortolotti Jan 05 '15 at 17:07
    • If you delete both directories and then restart the daemon (quitting and restarting Android Studio should do that), and it doesn't solve the problem, then I'm not sure what's going on. I'd ordinarily delete an answer if it wasn't the correct solution for a question, but in this case, it may help other people who find this question. – Scott Barta Jan 05 '15 at 17:10
    • Yes I did exactly that...Is it possible having to do with the version of Android Studio? well than thanks for your help! I keep trying. – Nicolas Bortolotti Jan 05 '15 at 17:28
    • What you mean with "your home directory"? I delete .gradle from project main folder. Should i delete another? – delavega66 Jun 29 '17 at 06:54
    1

    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
    
    Community
    • 1
    • 1
    John Snow
    • 1,898
    • 2
    • 27
    • 48
    0

    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.

    kor88
    • 11
    • 3