deptofdefense / AndroidTacticalAssaultKit-CIV

Other
0 stars 2 forks source link

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

Open Love-Fat opened 2 years ago

Love-Fat commented 2 years ago

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)

ahmadnav commented 2 years ago

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.

Dawgomatic commented 1 year ago

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.

ryanalex98 commented 1 year ago

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.

Dawgomatic commented 1 year ago

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.

ryanalex98 commented 1 year ago

@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

mateuszzz88 commented 1 year ago

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

sudo update-alternatives --config java