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

Compile error after pub add cronet_http (missing: Java_JAVAH_EXECUTABLE) #1312

Open
desmond1121 opened this issue Oct 2, 2024 · 3 comments
Assignees
Labels
package:cronet_http type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@desmond1121
Copy link

desmond1121 commented Oct 2, 2024

Platform: Windows

After flutter pub add cronet_http, my project compiles error with:

CMake Error at C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Java (missing: Java_JAVAH_EXECUTABLE) (found version
  "1.8.0.421")
Call Stack (most recent call first):
  C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.28/Modules/FindJava.cmake:326 (find_package_handle_standard_args)
  flutter/ephemeral/.plugin_symlinks/jni/src/CMakeLists.txt:31 (find_package)
2

Error: Unable to generate build files

I double check this issue by removing cronet_http dependency and then the project runs successfully.

This doesn't make sense, javah already deprecated (javah) and we can use javac -h now.

Flutter doctor result:

PS C:\Users\yaojy> flutter doctor -v
[√] Flutter (Channel stable, 3.24.2, on Microsoft Windows [Version 10.0.22631.4169], locale en-US)
    • Flutter version 3.24.2 on channel stable at C:\Users\yaojy\AppData\Local\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4cf269e36d (4 weeks ago), 2024-09-03 14:30:00 -0700
    • Engine revision a6bd3f1de1
    • Dart version 3.5.2
    • DevTools version 2.37.2

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at C:\Users\yaojy\AppData\Local\Android\Sdk
    • Platform android-35, build-tools 35.0.0
    • ANDROID_HOME = C:\Users\yaojy\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.10.4)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.10.35027.167
    • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2024.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)

[√] IntelliJ IDEA Community Edition (version 2024.1)
    • IntelliJ at C:\Program Files (x86)\ideaIC-2024.1.4.win
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart

[√] VS Code (version 1.93.1)
    • VS Code at C:\Users\yaojy\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.98.0
@desmond1121 desmond1121 added package:cronet_http type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Oct 2, 2024
@brianquinlan
Copy link
Collaborator

@desmond1121 I assume that you are trying to run your application on Windows (not that you are targeting Android on your Windows machine).

@ryanaltair
Copy link

Same problem. I add cronet_http to app, (support windows and android both), when RUN flutter build windows, I got this error.

CMake Error at C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Java (missing: Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE
  Java_JAVAC_EXECUTABLE Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE)
Call Stack (most recent call first):
  C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.29/Modules/FindJava.cmake:326 (find_package_handle_standard_args)
  flutter/ephemeral/.plugin_symlinks/jni/src/CMakeLists.txt:31 (find_package)

is there any way to solve this.

@ryanaltair
Copy link

I got a workaround:

  1. add jdk and maven
    choco install openjdk --version=17.0.2
    choco install maven
  2. add JAVA_HOME to WINDOWS env
    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:cronet_http type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants