Gradle in Android Studio giving error Project sync failed

后端 未结 10 1909
野性不改
野性不改 2020-12-11 04:09

I am new to Android Studio.I installed Android Studio-1.2.1.1 and i have jdk1.7.0_40 installed.I am facing problem with gradle build. For reference you can check gradle issu

相关标签:
10条回答
  • 2020-12-11 04:10

    For those who are on OS X El Capitan (v10.10) and end up with the above error message.

    In my case there was nothing wrong with Gradle, simply my Java 1.8 was "too new" for Android Studio 1.5 so I had to install older 1.7.

    I downloaded it from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html (jdk-7u79-macosx-x64.dmg)

    After all I had to just update JDK location in the project structure

    0 讨论(0)
  • 2020-12-11 04:10

    This happens because Android is using embedded ( JRE ) which is selected as recommended and at same time Android Studio detects JDK Home_Path (Environmental Variable ) and due to that two JAVA Path are different there is the conflict so it give you Error :

    If You remove java_home path or Environmental variable you will get this error:

    CreateProcess error=2, The system cannot find the file specified [Android studio

    For Android Studio, the solution is to go to File> Other Setting > Default Project Structure> Uncheck the checkbox and browse and set JDK path

    0 讨论(0)
  • 2020-12-11 04:13

    I already had java jdk 7u17 and I also had got same error as FaizAli.

    I try to search and done a lot of changes but not success!

    Then, I downloaded jdk 7u80 at this link and installed this jdk. After that those error gone.

    0 讨论(0)
  • 2020-12-11 04:16

    What I found out in my case is that the SDK my project pointed to "broke" and I had to fix its "JDK home path":

    0 讨论(0)
  • 2020-12-11 04:16

    This is 2019. For anyone experiencing this issue... The first thing is to make sure that you correctly set your environment variables as per this instruction: https://www.mkyong.com/java/how-to-set-java_home-on-windows-10/

    Which means you should be able to type javac -version and java -version and get the version number inside your Home directory.

    Once you can confirm this, then go to the Project Structure inside, the SDK Location > JDK Location select Use JAVA_HOME environment variable.

    This was what I did and it worked.

    0 讨论(0)
  • 2020-12-11 04:20

    Replace this

    C:\Program Files\Java\jdk1.7.0_40\jre
    

    with

    C:\Program Files\Java\jdk1.7.0_40
    

    inside your JAVA_HOME variable

    0 讨论(0)
提交回复
热议问题