fzyzcjy / flutter_rust_bridge

Flutter/Dart <-> Rust binding generator, feature-rich, but seamless and simple.

Home Page:https://fzyzcjy.github.io/flutter_rust_bridge/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cargokit BuildTool failed with error "cannot find the file"

qq351469076 opened this issue · comments

Describe the bug

Hello, when I ran the example on the official website, an error occurred.

cargo install 'flutter_rust_bridge_codegen@^2.0.0-dev.21' && \
    flutter_rust_bridge_codegen create my_app && cd my_app && flutter run

I develop on windows 11
Android emulator version is 33
I also installed ndk through sdk tools
image

The commands were also installed normally and successfully.

Then running flutter run gives the following error

Steps to reproduce

As long as I run the official website example command, I will get an error

Logs

PS C:\Users\Administrator\Desktop\dsd\my_app> flutter run
Flutter assets will be downloaded from https://mirrors.tuna.tsinghua.edu.cn/flutter. Make sure you trust this source!
Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
Flutter assets will be downloaded from https://mirrors.tuna.tsinghua.edu.cn/flutter. Make sure you trust this source!
ϵͳ�Ҳ���ָ����·����
ϵͳ�Ҳ���ָ����·����
ϵͳ�Ҳ���ָ�����ļ���
ϵͳ�Ҳ���ָ�����ļ���
Running pub get in "C:\Users\Administrator\Desktop\dsd\my_app\build\rust_builder\build\build_tool"
Resolving dependencies...
+ adaptive_number 1.0.0
+ args 2.4.2
+ async 2.11.0
+ build_tool 1.0.0 from path C:/Users/Administrator/Desktop/dsd/my_app/rust_builder/cargokit/build_tool
+ collection 1.18.0
+ convert 3.1.1
+ crypto 3.0.3
+ ed25519_edwards 0.3.1
+ fixnum 1.1.0
+ github 9.17.0 (9.22.0 available)
+ hex 0.2.0
+ http 1.1.0 (1.2.0 available)
+ http_parser 4.0.2
+ json_annotation 4.8.1
+ logging 1.2.0
+ meta 1.11.0
+ path 1.8.0 (1.9.0 available)
+ petitparser 5.4.0 (6.0.2 available)
+ source_span 1.10.0
+ string_scanner 1.2.0
+ term_glyph 1.2.1
+ toml 0.14.0 (0.15.0 available)
+ typed_data 1.3.2
+ version 3.0.0 (3.0.2 available)
+ yaml 3.1.2
Changed 25 dependencies!
6 packages have newer versions incompatible with dependency constraints.
Try `dart pub outdated` for more information.
Compiling bin/build_tool_runner.dart to kernel file bin/build_tool_runner.dill.
INFO: Precompiled binaries are disabled
INFO: Building rust_lib for x86_64-linux-android
INFO: Installing NDK 23.1.7779620
SEVERE: ================================================================================
SEVERE: Cargokit BuildTool failed with error:
SEVERE: --------------------------------------------------------------------------------
SEVERE: ProcessException: 系统找不到指定的文件�?
SEVERE:
SEVERE:   Command: C:\Users\Administrator\AppData\Local\Android\Sdk\cmdline-tools\latest\bin\sdkmanager.bat --install ndk;23.1.7779620
SEVERE: --------------------------------------------------------------------------------
SEVERE: #0      _ProcessImpl._runAndWait (dart:io-patch/process_patch.dart:488:7)
SEVERE: #1      _runNonInteractiveProcessSync (dart:io-patch/process_patch.dart:633:18)
SEVERE: #2      Process.runSync (dart:io-patch/process_patch.dart:68:12)
SEVERE: #3      runCommand (package:build_tool/src/util.dart:110:23)
SEVERE: #4      AndroidEnvironment.installNdk (package:build_tool/src/android_environment.dart:76:5)
SEVERE: #5      RustBuilder._buildEnvironment (package:build_tool/src/builder.dart:193:13)
SEVERE: #6      RustBuilder.build (package:build_tool/src/builder.dart:160:26)
SEVERE: #7      ArtifactProvider.getArtifacts (package:build_tool/src/artifacts_provider.dart:71:39)
SEVERE: <asynchronous suspension>
SEVERE: #8      BuildGradle.build (package:build_tool/src/build_gradle.dart:35:23)
SEVERE: <asynchronous suspension>
SEVERE: #9      BuildGradleCommand.runBuildCommand (package:build_tool/src/build_tool.dart:65:5)
SEVERE: <asynchronous suspension>
SEVERE: #10     BuildCommand.run (package:build_tool/src/build_tool.dart:37:5)
SEVERE: <asynchronous suspension>
SEVERE: #11     CommandRunner.runCommand (package:args/command_runner.dart:212:13)
SEVERE: <asynchronous suspension>
SEVERE: #12     runMain (package:build_tool/src/build_tool.dart:251:5)
SEVERE: <asynchronous suspension>
SEVERE: --------------------------------------------------------------------------------
SEVERE: BuildTool arguments: [build-gradle]
SEVERE: ================================================================================
Running Gradle task 'assembleDebug'...                             20.8s
√  Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app-debug.apk...          651ms
E/flutter ( 6237): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'librust_lib.so': dlopen failed: library "librust_lib.so" not found
E/flutter ( 6237): #0      _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11:43)
E/flutter ( 6237): #1      new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:22:12)
E/flutter ( 6237): #2      new ExternalLibrary.open (package:flutter_rust_bridge/src/platform_types/_io.dart:39:47)
E/flutter ( 6237): #3      loadExternalLibraryRaw (package:flutter_rust_bridge/src/loader/_io.dart:56:28)
E/flutter ( 6237): #4      loadExternalLibrary (package:flutter_rust_bridge/src/loader/_io.dart:14:10)
E/flutter ( 6237): #5      BaseEntrypoint._loadDefaultExternalLibrary (package:flutter_rust_bridge/src/main_components/entrypoint.dart:107:13)
E/flutter ( 6237): #6      BaseEntrypoint.initImpl (package:flutter_rust_bridge/src/main_components/entrypoint.dart:53:31)
E/flutter ( 6237): #7      RustLib.init (package:my_app/src/rust/frb_generated.dart:25:20)
E/flutter ( 6237): #8      main (package:my_app/main.dart:6:17)
E/flutter ( 6237): #9      _runMain.<anonymous closure> (dart:ui/hooks.dart:301:23)
E/flutter ( 6237): #10     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297:19)
E/flutter ( 6237): #11     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
E/flutter ( 6237):
Syncing files to device sdk gphone64 x86 64...                      56ms

Flutter run key commands.
r Hot reload.
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on sdk gphone64 x86 64 is available at: http://127.0.0.1:8518/J7j_PwgmDpU=/
I/.example.my_app( 6237): Compiler allocated 4533KB to compile void android.view.ViewRootImpl.performTraversals()

Expected behavior

By running the official website example and running successfully

Generated binding code

No response

OS

windows11

Version of flutter_rust_bridge_codegen

flutter_rust_bridge_codegen@^2.0.0-dev.21

Flutter info

Flutter assets will be downloaded from https://mirrors.tuna.tsinghua.edu.cn/flutter. Make sure you trust this source!
[√] Flutter (Channel stable, 3.16.8, on Microsoft Windows [版本 10.0.22621.3007], locale zh-CN)
    • Flutter version 3.16.8 on channel stable at D:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 67457e669f (8 days ago), 2024-01-16 16:22:29 -0800
    • Engine revision 6e2ea58a5c
    • Dart version 3.2.5
    • DevTools version 2.28.5
    • Pub download mirror https://mirrors.tuna.tsinghua.edu.cn/dart-pub
    • Flutter download mirror https://mirrors.tuna.tsinghua.edu.cn/flutter

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

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\Administrator\AppData\Local\Android\sdk
    X cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.

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

[√] Visual Studio - develop Windows apps (Visual Studio Community 2019 16.11.29)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.11.33927.289
    • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2023.1)
    • Android Studio at C:\Users\Administrator\AppData\Local\Programs\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.7+0-b2043.56-10550314)

[√] Connected device (4 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 13 (API 33) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [版本 10.0.22621.3007]
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 120.0.6099.225
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 120.0.2210.121

[!] Network resources             
    X A network error occurred while checking "https://github.com/": 信号灯超时时间已到


! Doctor found issues in 2 categories.

Version of clang++

16.0.6

Additional context

No response

Hi! Thanks for opening your first issue here! 😄

Hi, this seems like a cargokit error - flutter_rust_bridge's default template uses cargokit to make Rust+Dart compilation. So it would be great to ask there too.

SEVERE: ProcessException: 系统找不到指定的文件�?
SEVERE:
SEVERE: Command: C:\Users\Administrator\AppData\Local\Android\Sdk\cmdline-tools\latest\bin\sdkmanager.bat --install ndk;23.1.7779620

So, does C:\Users\Administrator\AppData\Local\Android\Sdk\cmdline-tools\latest\bin\sdkmanager.bat this file exist? What happens if you manually execute that command?

image

the picture solve my problem
thanks

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.