Error while importing projects

一笑奈何 提交于 2019-11-30 08:45:47

I had lots of similar problems and I think that the best solution is to specify JDK location manually. In order to do it:

Add two files to project root folder gradle.properties:

org.gradle.java.home=C:/Program Files/Java/jdk1.7.0_03

and local.properties:

org.gradle.java.home=C:/Program Files/Java/jdk1.7.0_03

You should change org.gradle.java.home value to JDK path in your system. If you will have the same problem with android SDK add sdk.dir=/Users/alonzilberman/Android/adt-bundle-mac-x86_64-20130917/sdk to your local.properties.

After adding files refresh gradle build.

I got the same message while trying to build a project in Android Studio. After hours of research, trying different versions of JDK (from 8 to 6) I found this answer that fixed my problem: https://discuss.gradle.org/t/mac-gradle-issues-with-finding-using-jdk-7-the-usual-answers-to-this-question-arent-working-expert-required/2553/24

The reason was that the AUSKey package installed a tools.jar in /Library/Java/Extensions directory that derailed Gradle looking for the compiler. Removing that file fixed the problem and I can now build in Android Studio.

Create a new system variable called JAVA_HOME and add

C:\Program Files\Java\jdk1.8.0_25

It's because your environment variable isn't pointing to your jdk folder. Don't point it to your bin folder.

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