AndroidTacticalAssaultKit-CIV icon indicating copy to clipboard operation
AndroidTacticalAssaultKit-CIV copied to clipboard

build 32-bit Java specified while targeting a 64-bit build

Open Love-Fat opened this issue 2 years ago • 6 comments

32-bit Java specified while targeting a 64-bit build. Call Stack (most recent call first): src/main/jni/CMakeLists.txt:7 (validate_java_exists)

Love-Fat avatar Jul 25 '22 02:07 Love-Fat

Make sure you have java 1.8 installed, jdk9+ does not support the java -d64 and -d32 cmds, the "validate_java_exists" function relies on those to check 64? 32. Or just set that boolean in the cmake function to just be true.

ahmadnav avatar Aug 31 '22 22:08 ahmadnav

Currently spent a couple days trouble shooting this error on an ubuntu20.04 machine trying to build ATAK in android studio.

32-bit Java specified while targeting a 64-bit build.
Call Stack (most recent call first):
src/main/jni/CMakeLists.txt:7 (validate_java_exists)

as stated in the comments of AndroidTacticalAssaultKit-CIV/takkernal/engine/cmake/support/ValidateJavaExists.cmake

# Due to an existing bug in the FindJNI module, FindJNI will not respect the JAVA_HOME CMake environment variable if a
# JDK is specified on the system PATH. Thus, if there are multiple JDKs on the system, the first JDK found in PATH
# will be validated against

this effectively makes setting JAVA_HOME useless

I located my java versions in the folder /usr/lib/jvm and deleted everything but java-1.8.0-openjdk-amd64 and java-8-openjdk-amd64.

This fixed the error.

Dawgomatic avatar Jan 01 '23 00:01 Dawgomatic

Having the same issue here. Ubuntu 20.04, trying to build ATAK (specifically, Gradle Sync) in Android Studio.

I deleted all other java versions (except java-1.8.0-openjdk-amd64 and java-8-openjdk-amd64) in /usr/lib/jvm as mentioned by @jruroede but the issue persists on my end unfortunately. I've updated the Java JDK location both using $JAVA_HOME and via Android Studio.

Thinking about overwriting the cmake to just return true as mentioned above.

ryanalex98 avatar Jan 20 '23 17:01 ryanalex98

Can you post the exact error for me?

Also go to android studio and look in settings -> build, execution, deployment -> gradle and take a screenshot.

also post what your local.properties files looks like.

Dawgomatic avatar Jan 20 '23 19:01 Dawgomatic

@jruroede

Error:

CMake Error at cmake/support/ValidateJavaExists.cmake:55 (message):
32-bit Java specified while targeting a 64-bit build.
Call Stack (most recent call first):
src/main/jni/CMakeLists.txt:7 (validate_java_exists)

Local Properties:

sdk.dir=/home/ryanalexander/Android/Sdk
ndk.dir=/home/ryanalexander/Android/Sdk/ndk
cmake.dir=/home/ryanalexander/ATAK/CMAKE_for_ATAK
takDebugKeyFile=debug.keystore
takDebugKeyFilePassword=android
takDebugKeyAlias=androiddebugkey
takDebugKeyPassword=android
takReleaseKeyFile=...
takReleaseKeyFilePassword=...
takReleaseKeyAlias=...
takReleaseKeyPassword=...

(I only intend to use debug for now, I'll set the release key later.)

Gradle - I couldn't find the settings under "Build, Execution, Deployment" but I'll show where I select a Java option as well as my /usr/lib/jvm folder: Screenshot from 2023-01-21 03-42-59

Screenshot from 2023-01-21 03-41-32

ryanalex98 avatar Jan 21 '23 03:01 ryanalex98

On Ubuntu 22.04 I managed to solve this without removing system-installed JDKs by using

sudo update-alternatives --config java

mateuszzz88 avatar Mar 24 '23 10:03 mateuszzz88