Android Build Error: Unable to locate Java VM. Ple

2019-09-02 08:17发布

问题:

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