android studio java_home未正确定义

时间:2022-03-12 23:16:31

I had imported a project from eclipse to android studio. I followed the instructions how to export by generating a gradle from eclipse. As expected, things didn't go smoothly when importing it into android studio. I have encountered this error in my gradle.

我从eclipse导入了一个项目到android studio。我按照说明如何通过从eclipse生成gradle导出。正如预期的那样,将其导入android studio时情况并不顺利。我在我的gradle中遇到了这个错误。

Error : (1,0) Plugin with id 'com.android.application' not found.

Then I entered this command in the terminal: ant -debug. I found that JAVA_HOME is not defined correctly. I found out it was about gradle. I checked my gradle with gradle -v but gradle was not available. I solved it by creating a symbolic link and solved the problem.

然后我在终端输入了这个命令:ant -debug。我发现JAVA_HOME没有正确定义。我发现这是关于gradle。我用gradle -v检查了我的gradle但是没有gradle。我通过创建符号链接解决了问题。

------------------------------------------------------------
Gradle 1.4
------------------------------------------------------------

Gradle build time: Monday, September 9, 2013 8:44:25 PM UTC
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.9.3 compiled on April 8 2014
Ivy: non official version
JVM: 1.7.0_67 (Oracle Corporation 24.65-b04)
OS: Linux 3.13.0-36-generic amd64

So, I tried ant -debug again and got this error:

所以,我再次尝试了ant -debug并得到了这个错误:

JAVA_HOME is not defined correctly.
We cannot execute /usr/local/java/jre1.7.0_45/bin/java

echo $JAVA_HOME gave me this /usr/local/java/jre1.7.0_45

echo $ JAVA_HOME给了我这个/usr/local/java/jre1.7.0_45

I checked my /etc/environment with the following result: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"

我用以下结果检查了我的/ etc / environment:PATH =“/ usr / local / sbin:/ usr / local / bin:/ usr / sbin:/ usr / bin:/ sbin:/ bin:/ usr / games:在/ usr /本地/游戏”

How do I solve this? I tried many solutions, none of them worked. I already spent a day working this out. Any advice would be appreciated. If you need additional info, just tell me.

我该如何解决这个问题?我尝试了很多解决方案,但都没有。我已经花了一天时间来解决这个问题。任何意见,将不胜感激。如果您需要其他信息,请告诉我。

1 个解决方案

#1


1  

This problem was solved. I tried a different approach in migrating my project to the android studio.

这个问题解决了。我尝试了一种不同的方法将我的项目迁移到android工作室。

I did not follow the steps in the android developer's site.

我没有按照android开发者网站中的步骤进行操作。

I imported it without generating **gradle from eclipse**.

我导入它而没​​有从日食**产生** gradle。

I made a copy of my project from eclipse and imported it using the import project in android studio it automatically generated its own gradle and included the libraries I used in eclipse. It took a while but it worked.

我从eclipse中复制了我的项目并使用android studio中的import项目导入它,它自动生成了自己的gradle并包含了我在eclipse中使用的库。花了一段时间但它确实有效。

#1


1  

This problem was solved. I tried a different approach in migrating my project to the android studio.

这个问题解决了。我尝试了一种不同的方法将我的项目迁移到android工作室。

I did not follow the steps in the android developer's site.

我没有按照android开发者网站中的步骤进行操作。

I imported it without generating **gradle from eclipse**.

我导入它而没​​有从日食**产生** gradle。

I made a copy of my project from eclipse and imported it using the import project in android studio it automatically generated its own gradle and included the libraries I used in eclipse. It took a while but it worked.

我从eclipse中复制了我的项目并使用android studio中的import项目导入它,它自动生成了自己的gradle并包含了我在eclipse中使用的库。花了一段时间但它确实有效。