Android Build Error: Unable to locate Java VM. Please set JAVA_HOME environment variable

夙愿已清 提交于 2019-12-13 05:29:46

问题


I'm using Ti Studio on Win7, and my project builds and works when I have my Android plugged in via USB and I run using "Android Device".

However, when I try to buid it for distribution I get:

[ERROR] Program launch failed. Unable to locate Java VM. Please set JAVA_HOME environment variable.

I have looked at this thread which describes a similar problem, and verified that JAVA_HOME is set:

+>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.6.0_29

Also, in Ti Studio I have verified that Preferences->Studio->Platforms->Android has the "Android SDK Home" set to the path where Android SDK is installed.

Can anyone guide me on what else I need to do to fix this?

Thanks!

UPDATE FOR ANAND

+>javac -version
javac 1.6.0_29

+>java -version
java version "1.7.0_01"
Java(TM) SE Runtime Environment (build 1.7.0_01-b08)
Java HotSpot(TM) 64-Bit Server VM (build 21.1-b02, mixed mode)

回答1:


Did you read System Requirements?

From Documentation:

For Windows, the 32-bit version of Java JDK is required regardless of whether Titanium is running on a 32-bit or 64-bit system.

Try to install additional 32bit version of Java (without removing the 64bit) and set the system variable.

You may refer this answer.

Hope it helped you




回答2:


Configure environment variables as mentioned here and JDK must be 32 bit



来源:https://stackoverflow.com/questions/19942350/android-build-error-unable-to-locate-java-vm-please-set-java-home-environment

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