Open chifandeyu opened 1 year ago
cd example && flutter run -d windows
- What is the system version? win11?
- Is it works fine if you build with flutter command?
cd example && flutter run -d windows
flutter clean flutter run -d windows 执行后就是报了上面的错误。
flutter doctor:
[✓] Flutter (Channel stable, 3.3.8, on Microsoft Windows [版本 10.0.19044.2006], locale zh-CN)
• Flutter version 3.3.8 on channel stable at D:\DevTools\flutter3.3.8_custom\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 52b3dc25f6 (6 weeks ago), 2022-11-09 12:09:26 +0800
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0
[!] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
• Android SDK at C:\Users\yuchang.xu\AppData\Local\Android\sdk
• Platform android-33, build-tools 32.0.0
✗ Android SDK file not found: C:\Users\yuchang.xu\AppData\Local\Android\sdk\build-tools\32.0.0\aapt.
• Try re-installing or updating your Android SDK,
visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions.
[✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.7)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.11.31911.196
• Windows 10 SDK version 10.0.19041.0
[✓] Android Studio (version 2020.3)
• Android Studio at D:\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 11.0.10+0-b96-7249189)
[✓] VS Code (version 1.74.1)
• VS Code at C:\Users\yuchang.xu\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.44.0
[✓] Connected device (1 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [版本 10.0.19044.2006]
[✓] HTTP Host Availability
• All required HTTP hosts are available
Fine, I know very little about Windows development ,so may have to wait for someone else to answer the reason.
But this project with new win_toast plugin was build successful on GitHub Actions. https://github.com/MixinNetwork/flutter-app/actions/runs/3657044403/jobs/6180183222
Hello, any updates for this issues ? i got same issues
Hi, i just solved the issue after add some code on CMakeList on this package @chifandeyu
cmake_minimum_required(VERSION 3.14)
set(PROJECT_NAME "win_toast")
project(${PROJECT_NAME} LANGUAGES CXX)
# This value is used when generating builds using this plugin, so it must
# not be changed
set(PLUGIN_NAME "win_toast_plugin")
# Find Nuget First
find_program(NUGET_EXE NAMES nuget)
if(NOT NUGET_EXE)
message("NUGET.EXE not found.")
message(FATAL_ERROR "Please install this executable, and run CMake again.")
endif()
# Install WinRT using Nuget
exec_program(${NUGET_EXE}
ARGS install "Microsoft.Windows.CppWinRT" -Version 2.0.221121.5 -ExcludeVersion -OutputDirectory ${CMAKE_BINARY_DIR}/packages)
add_library(${PLUGIN_NAME} SHARED
win_toast_plugin.cpp
pch.h
DesktopNotificationManagerCompat.h
DesktopNotificationManagerCompat.cpp
notification_manager.h
notification_manager.cc
dll_importer.cc
dll_importer.h
)
apply_standard_settings(${PLUGIN_NAME})
set_target_properties(${PLUGIN_NAME} PROPERTIES
CXX_VISIBILITY_PRESET hidden)
set_target_properties(${PLUGIN_NAME} PROPERTIES
# add VS Project Import
VS_PROJECT_IMPORT ${CMAKE_BINARY_DIR}/packages/Microsoft.Windows.CppWinRT/build/native/Microsoft.Windows.CppWinRT.props
)
# Link the WinRT Lib
target_link_libraries(${PLUGIN_NAME} PRIVATE ${CMAKE_BINARY_DIR}/packages/Microsoft.Windows.CppWinRT/build/native/Microsoft.Windows.CppWinRT.targets)
target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL)
target_include_directories(${PLUGIN_NAME} INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin)
# List of absolute paths to libraries that should be bundled with the plugin
set(win_toast_bundled_libraries
""
PARENT_SCOPE
)
Hello everyone,
Just installed the plugin and I have the exact same issue And the fix provided by @ekokurniadi does work
Is it possible to integrate it in the plugin directly ?