Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jni plugin requires jdk to have awt. #1942

Open
bsutton opened this issue Jan 24, 2025 · 2 comments
Open

jni plugin requires jdk to have awt. #1942

bsutton opened this issue Jan 24, 2025 · 2 comments

Comments

@bsutton
Copy link

bsutton commented Jan 24, 2025

I've just added the cronent_http package to my app which I'm testing on linux (ubuntu).

From my understanding cronet_http uses jni and I can see the generated_plugings.cmake file (under linux/flutter) has been updated to include 'jni' as a plugin.

list(APPEND FLUTTER_FFI_PLUGIN_LIST
  jni
  pdfrx
)

The problem is that when I do a linux build I'm getting the following error:

flutter build linux
Changing current working directory to: .../git/pigation2/pig_app

CMake Error at /usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find JNI (missing: AWT)
Call Stack (most recent call first):
  /usr/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.28/Modules/FindJNI.cmake:589 (find_package_handle_standard_args)
  flutter/ephemeral/.plugin_symlinks/jni/src/CMakeLists.txt:32 (find_package)


Building Linux application...                                           
Unable to generate build files

I believe the problem is that I have openjdk-headless installed which doesn't included awt.

Given I can't imagine a scenario where someone would be trying to access awt via jni (would it even work) it would be good to remove the awt check from the make script.

@brianquinlan
Copy link
Contributor

@HosseinYousefi does package:jni check for the presence of AWT?

@HosseinYousefi
Copy link
Member

No, it doesn't. Apparently if I add

set(JAVA_AWT_LIBRARY NotNeeded)
set(JAVA_JVM_LIBRARY NotNeeded)
set(JAVA_INCLUDE_PATH2 NotNeeded)
set(JAVA_AWT_INCLUDE_PATH NotNeeded)

to cmake, it should fix it. I will open a PR tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

3 participants