简体   繁体   中英

Android studio jdk and gradle errors

It's about the 10 time i try to install and run Android Studio but i have always a problem! I can't work with it! But i want to migrate from Eclipse. I solved a problem that not recognized the sdk path, i solved the problem that not recognized my device and then i have another two propblems!

1)Error:Gradle version 1.10 is required. Current version is 2.2.1. If using the gradle wrapper

2)Error:The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:\\Users\\Admin\\Desktop\\adt-bundle-windows-x86_64-20140702\\sdk\\bin\\java.exe

And i can't solve them. The second one it's incredible!!! I don't have the jdk there! I set the jdk path in Project Structure and the jdk location is:

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

Anyone can help me please?

Solution of first is:

You have to change this line in build.gradle (this is the gradle plugin for Android)

classpath 'com.android.tools.build:gradle:1.1.+'

The version of Android gradle plugin needs to be compatible with the version of Gradle.

Make sure the distributionUrl is specified as gradle-1.10-all.zip at the Gradle-wrapper properties file within the Android project.

This line in gradle-wrapper.properties (this is the gradle version)

distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip

在此输入图像描述

Solution of second is:

  1. if you do not have JAVA_HOME Variable into environment variables then

Set the JAVA_HOME Variable

Once you have the JDK installation path:

Right-click the My Computer icon on your desktop and select Properties. Click the Advanced tab. Click the Environment Variables button. Under System Variables, click New. Enter the variable name as JAVA_HOME. Enter the variable value as the installation path for the Java Development Kit. Click OK. Click Apply Changes.

  1. If you have JAVA_HOME value then

Change the value of environment variable JAVA_HOME to C:\\Program Files (x86)\\Java\\Jre7\\ instead of C:\\Program Files (x86)\\Java\\Jre7\\bin\\java.exe

JAVA_HOME should be always pointing to the parent directory of JDK or JRE installation inside of which, we find the bin directory containing the java, javac, etc. binaries

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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