Win10下flutter编译localsend笔记

这篇具有很好参考价值的文章主要介绍了Win10下flutter编译localsend笔记。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

为了方便手机和电脑之间的传输数据,同时考虑下一步局域网内电脑传输方便性,从网上发现了开源软件localsend,该软件是基于flutter开发的,历时大半天才编译成功,记录一下学习过程。

1、localsend软件

LocalSend 是一款免费、开源、跨平台的局域网文件互传工具,无需互联网,无需外部服务器。即开即用,支持 Windows、macOS、Linux,以及 iOS、Android。

LocalSend 在 GitHub 开源,你完全可以自己编译客户端,然后在内网使用。下载地址如下:

GitHub - localsend/localsend: An open-source cross-platform alternative to AirDrop

2、flutter简介

flutter是谷歌的移动UI框架,“只要一套代码库,即可构建、测试和发布适用于移动、Web、桌面和嵌入式平台的精美应用”,从闲鱼到淘宝,从QQ到微信,从京东到百度,从美团到抖音,BAT等一线互联网大厂在全面拥抱Flutter。2020 短短一年里,Flutter在GitHub 和 StackOverflow已经赶超React Native成为开发者首选跨平台框架。

flutter具有以下特性:

  1. 具有跨平台开发特性,支持IOS、Android、Web三端。
  2. 热重载特性大大提高了开发效率
  3. 自绘UI引擎和编译成原生代码的方式,使得系统的运行时的高性能成为了可能
  4. 使用Dart语言,目前已经支持同时编译成Web端代码

3、搭建flutter开发环境

详见https://flutter.cn/community/china:在中国网络环境下使用 Flutter - Flutter 中文文档 - Flutter 中文开发者网站 - Flutter

在Windows上要安装并运行Flutter要满足以下最低要求: 

操作系统: Windows 7 SP1或更新版本

磁盘空间: 400 MB (不包括IDE/tools的磁盘空间).

工具: Flutter 依赖下面这些命令行工具:

Windows PowerShell 5.0 Windows 10已经预装了这个工具;

Git for Windows 2.x确保Windows电脑下载并安装了Git工具;

以清华镜像为例

3.1设置环境变量

PUB_HOSTED_URL=https://mirrors.tuna.tsinghua.edu.cn/dart-pub

FLUTTER_STORAGE_BASE_URL=https://mirrors.tuna.tsinghua.edu.cn/flutter

3.2下载SDK

Flutter SDK 归档列表 - Flutter 中文文档 - Flutter 中文开发者网站 - Flutter 下载稳定版本SDK,最开始我下载了最新的3.16.3(后来发现给自己挖了一个大坑)。

将安装包zip解压到你想安装Flutter SDK的路径(如:C:\src\flutter;注意,不要将flutter安装到需要一些高权限的路径如C:\Program Files\)。

设置Path环境变量:

error: type 'decodercallback' not found. decodercallback decode, // ignore:,flutter,flutter,笔记,经验分享

3.3获取依赖

     利用CMD窗口进入下载好的localsend源程序路径下执行:

E:\Software\localsend-1.13.1\localsend-1.13.1\app>flutter pub get

当配置好环境变量后,手动或自动执行 flutter pub get 后会使用无法正常下载依赖包,时间长了会出现下面的错误Got TLS error trying to find package xxx

解决方案:

利用360浏览器打开Index of /dart-pub/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror

右键属性:

error: type 'decodercallback' not found. decodercallback decode, // ignore:,flutter,flutter,笔记,经验分享

error: type 'decodercallback' not found. decodercallback decode, // ignore:,flutter,flutter,笔记,经验分享

导出flutter_pub.der证书文件,然后利用openssl转化成pem文件

E:\flutter>openssl x509 -inform der -in flutter_pub.der -out flutter_pub.pem

说明:https://www.sslshopper.com/certificate-decoder.html可以查看pem文件是否正确,结果如下:

Certificate Information:

Common Name: tuna.tsinghua.edu.cn

Subject Alternative Names: *.tuna.tsinghua.edu.cn, tuna.tsinghua.edu.cn

Organization:

Organization Unit:

Locality:

State:

Country:

Valid From: December 7, 2023

Valid To: March 6, 2024

Issuer: R3, Let's Encrypt

Key Size: 2048 bit

Serial Number: 0360c873c42e84d581f57896df6c2921c5c1

接着配置环境变量

DART_VM_OPTIONS=--root-certs-file=E:\flutter\flutter_pub.pem

再次执行命令,成功下载依赖。

3.4安装VS2022

     由于要在windows下编译flutter程序,需要打开系统的开发者模式,执行命令start ms-settings:developers

error: type 'decodercallback' not found. decodercallback decode, // ignore:,flutter,flutter,笔记,经验分享

对于 Windows 桌面开发而言,除了 Flutter SDK 以外你还需要以下内容:

Visual Studio 2022 或 Visual Studio 2022 生成工具 在选择安装 Visual Studio 时或只安装生成工具的时候,你需要选择「使用 C++ 的桌面开发」,包括其所有默认组件,以安装必要的 C++ 工具链和 Windows SDK 的头文件。

下载Visual Studio,下载地址:https://visualstudio.microsoft.com/zh-hans/downloads/

运行安装程序后,选择 使用 C++ 进行桌面开发工作负载,包括其所有默认组件

error: type 'decodercallback' not found. decodercallback decode, // ignore:,flutter,flutter,笔记,经验分享

基本上是说,如果您想为 Windows 开发 Flutter 应用程序,则需要安装Visual Studio 2022,在安装 Visual Studio 2022 时,您需要下载:Desktop development with C++

3.5 flutter doctor检查

运行flutter doctor检查

E:\flutter>flutter doctor

Flutter assets will be downloaded from https://mirrors.tuna.tsinghua.edu.cn/flutter. Make sure you trust this source!

Doctor summary (to see all details, run flutter doctor -v):

[√] Flutter (Channel stable, 3.13.9, on Microsoft Windows [版本 10.0.19045.3693], locale zh-CN)

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

[X] Android toolchain - develop for Android devices

    X Unable to locate Android SDK.

      Install Android Studio from: https://developer.android.com/studio/index.html

      On first launch it will assist you in installing the Android SDK components.

      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).

      If the Android SDK has been installed to a custom location, please use

      `flutter config --android-sdk` to update to that location.

[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)

    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.3)

[!] Android Studio (not installed)

[√] Connected device (2 available)

[√] Network resources

! Doctor found issues in 3 categories.

此时就完成了flutter环境的构建。

4、localsend软件编译

在E:\Software\localsend-1.13.1\localsend-1.13.1\app路径下执行:

flutter build windows

最开始由于我下载的3.16.3版本的flutter,编译报错:

/C:/Users/Administrator/AppData/Local/Pub/Cache/hosted/mirrors.tuna.tsinghua.edu.cn%2547dart-pub%2547/photo_manager-2.8.1/lib/src/internal/image_provider.dart(71,5): error G5FE39F1E: Type 'DecoderCallback' not found. [E:\Software\localsend-1.13.1\localsend-1.13.1\app\build\windows\x64\flutter\flutter_assemble.vcxproj]

/C:/Users/Administrator/AppData/Local/Pub/Cache/hosted/mirrors.tuna.tsinghua.edu.cn%2547dart-pub%2547/photo_manager-2.8.1/lib/src/internal/image_provider.dart(96,5): error G5FE39F1E: Type 'DecoderCallback' not found. [E:\Software\localsend-1.13.1\localsend-1.13.1\app\build\windows\x64\flutter\flutter_assemble.vcxproj]

/C:/Users/Administrator/AppData/Local/Pub/Cache/hosted/mirrors.tuna.tsinghua.edu.cn%2547dart-pub%2547/photo_manager-2.8.1/lib/src/internal/image_provider.dart(71,5): error G93EAFBA7: 'DecoderCallback' isn't a type. [E:\Software\localsend-1.13.1\localsend-1.13.1\app\build\windows\x64\flutter\flutter_assemble.vcxproj]

/C:/Users/Administrator/AppData/Local/Pub/Cache/hosted/mirrors.tuna.tsinghua.edu.cn%2547dart-pub%2547/photo_manager-2.8.1/lib/src/internal/image_provider.dart(96,5): error G93EAFBA7: 'DecoderCallback' isn't a type. [E:\Software\localsend-1.13.1\localsend-1.13.1\app\build\windows\x64\flutter\flutter_assemble.vcxproj]

e:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5): error MSB8066:   E:\Software\localsend-1.13.1\localsend-1.13.1\app\build\windows\x64\CMakeFiles\3e2763436f533117eea22937f39400f3\flutter_windows.dll.rule;E:\Software\localsend-1.13.1\localsend-1.13.1\app\build\windows\x64\CMakeFiles\2a8a145387b0dca97778dabe97f93418\flutter_assemble.rule; [E:\Software\localsend-1.13.1\localsend-1.13.1\app\build\windows\x64\flutter\flutter_assemble.vcxproj]

耽误了很多时间,重新下载3.13.9版本的flutter解决问题。

E:\Software\localsend-1.13.1\localsend-1.13.1\app>flutter build windows

Flutter assets will be downloaded from https://mirrors.tuna.tsinghua.edu.cn/flutter. Make sure you trust this source!

Building Windows application...                                   126.7s

√  Built build\windows\runner\Release\localsend_app.exe (0.2MB).文章来源地址https://www.toymoban.com/news/detail-797356.html

到了这里,关于Win10下flutter编译localsend笔记的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • flutter build hap打包编译时报错:hvigor ERROR: Failed :entry:default@CompileArkTS...

    有人遇到类似问题吗?不知道怎么解决了

    2024年04月09日
    浏览(31)
  • Win10编译安装openssl 1.1.1和 GPG

    参考: openssl/NOTES-WINDOWS.md at master · openssl/openssl · GitHub 安装Strawberry Perl Strawberry Perl for Windows 1.2 下载openssl源码 下载 1.1.1u版本 /source/index.html 1.3 安装NASM 下载NASM ,stable版本即可 https://www.nasm.us/ 1.4 安装Microsoft Visual C compiler 因为这里本地机器装过 Visual Studio 社区版, 所以需要

    2024年02月04日
    浏览(29)
  • behaviac —— Win10下Vs2017编译“腾讯行为树“源码

    简介 - 腾讯行为树      behaviac是游戏AI的开发框架组件,也是游戏原型的快速设计工具。支持全平台,适用于客户端和服务器,助力游戏快速迭代开发 。编辑器可以运行在PC上,操作方便直观可靠,支持实时和离线调试;编辑器可以导出xml,bson等多种格式,更可以导出

    2023年04月22日
    浏览(43)
  • win10下vscode+cmake编译C代码操作详解

    当我们只有一个.c文件时直接使用vscode+Code Runner插件即可完成编译,如果我们的工程很复杂包含多个.c文件时建议使用cmake来生成对应的make,指导编译器完成编译,否则会提示各种错误,如下: 实际上这些函数都是包含在其它.c文件里的,由于vscode的Code Runner插件只支持编译

    2024年01月20日
    浏览(26)
  • win10 + cmake3.17 编译 giflib5.2.1

    所有源文件已经打包上传csdn,大家可自行下载。 1. 下载giflib5.2.1,解压。         下载地址:GIFLIB - Browse Files at SourceForge.net 2. 下载CMakeLists.txt 及其他依赖的文件 从github上的osg-3rdparty-cmake项目: https://github.com/bjornblissing/osg-3rdparty-cmake/tree/master/giflib 下载giflib文件夹下的文

    2024年02月05日
    浏览(26)
  • opencv4.7.0 win10 源码编译 vs2019 cmake

    步骤: ① 编译opencv源码;注意几个下载内容;根据cmakedownloadlog.txt中的说明 ② 生成opencv.sln,先使用ALL_BUILD生成 ③ 然后对install工程进行生成 ④ 使用:离线使用,opencv文件夹 install的include lib bin 等复制到当前工程下的文件夹;然后配置属性     配置属性时注意一下路径,工

    2024年02月04日
    浏览(55)
  • Win10 + VS2022 + OpenCV 4.7 + contrib + cuda加速 编译

    https://download.csdn.net/download/Kasper_2009/88252429 https://download.csdn.net/download/Kasper_2009/88252429 在cmd命令中打nvidia-smi看支持的cuda最高版本 cuda版本选择也不能过于早,作者之前用过cuda11.2,在后续vs编译环节发现其最高只支持vs2019,不支持vs2022。目前作者使用cuda11.8。 下载安装cuda:CU

    2024年02月17日
    浏览(33)
  • Visual Studio Community 2022 + Win10 编译 OpenCPN 5.9.0 记录

    前两天尝试用vs2017编译OpenCPN5.0.0,前后折腾了两三天总算编译成功了。官网给出的编译过程比较简单,我在实际编译过程中遇上了很多很多的问题,最多的就是缺少库,好在最后编译通过了。 后来浏览OpenCPN官网的时候发现发布了“5.8.0 Fast Track”,说的就是5.8.0以上的版本的

    2024年02月09日
    浏览(39)
  • 联想台式电脑重装系统win10重启后出现error1962

    前提准备: U盘(若u盘内容有用需提前备份,会被格式化) 下载好win10系统镜像文件(我用的是link, 提取码 :29y3原博文链接:link 启动盘制作工具(我用的是 大白菜 ) 联想一体机进入 Bios 是 F1 键/

    2024年02月12日
    浏览(165)
  • win10 + vs2017 + cmake3.17 编译 freetype2.6.5

    按照cmake安装的正常流程走即可。 依赖库:zlib,png. 备注: 在cmake--Configure时,配置zlib和png依赖库。修改cmake的install目录。 两个依赖库的安装,在我的其他教程里有。不再赘述。

    2024年02月05日
    浏览(35)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包