Flutter插件发布

在这里插入图片描述

Flutter插件发布

新建插件包

Application

  • 原生Flutter工程

plugin

  • iOS和Android差异化

package

  • dart通用

module

  • 混合工程

科学上网

检查插件和发布插件需要在当前项目路径下

检查插件

  • flutter packages pub publish --dry-run

发布插件

  • flutter packages pub publish

    • 必须翻墙
    • 准备一个谷歌账号

发布爬坑

第一次发布(要求验证)

  • Looks great! Are you ready to upload your package (y/n)? y
    Pub needs your authorization to upload packages on your behalf.
    In a web browser, go to https://accounts.google.com/o/oauth2/auth?*******userinfo.email
    Then click “Allow access”.

    • 复制链接到浏览器。点击授权即可

非第一次发布

  • 坑一(代理未翻墙)

    • Waiting for your authorization…
      Authorization received, processing…
      It looks like accounts.google.com is having some trouble.
      Pub will wait for a while before trying to connect again.
      OS Error: Operation timed out, errno = 60, address = accounts.google.com, port = 53481
      pub finished with exit code 69

      • 不同的翻墙工具解决方式不同【端口号为代理的端口号】

        • export https_proxy=http://127.0.0.1:51837
          export http_proxy=http://127.0.0.1:51837
      • 127.0.0.1 固定写法

      • 端口号在翻墙的代理设置里边查看

  • 坑二(未指定服务器)

    • pub finished with exit code 69

      • flutter packages pub publish --server=https://pub.dartlang.org

      • sudo flutter packages pub publish -v

        可以查看详细信息

  • 坑三(未填写LICENSE)

Uploading…
LICENSE file LICENSE contains generic TODO.

	- 解决方案:在github到处一份LICENSE

		- BSD 3-Clause License

Copyright © 2020, 宋斌
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this
    list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice,
    this list of conditions and the following disclaimer in the documentation
    and/or other materials provided with the distribution.

  3. Neither the name of the copyright holder nor the names of its
    contributors may be used to endorse or promote products derived from
    this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

  • 坑四(项目名字和已经发布的接近或者冲突)

    • Package name is too similar to another active or moderated package

      • 解决方案:创建项目时候添加前缀
  • 坑五(pubspec.yaml配置)

    • name: bean_flutter_toast
      description: A mark toast Flutter package. Welcome to communicate! wechat -song-bin-
      version: 0.0.1
      author: -song-bin-
      homepage: https://blog.csdn.net/song_bin

      • name:需要和项目保持一致
      • author:已经被废除,被谷歌邮箱替代
      • description:描述文字不能过少,也不能超过一定的长度
      • version:建议发布版本1.0.0以及以上【需要和CHANGELOG.md保持一致】
      • homepage:需要配置一个可访问的链接
  • 坑六(packages get卡住)

    • Running “flutter packages get” in project_name…

      • zsh[新系统推荐]
      • bash
  • 坑七(端口号未设置)

    • bean@beansongs-mbp flutter_toast % flutter doctor
      Doctor summary (to see all details, run flutter doctor -v):
      [✓] Flutter (Channel stable, 1.20.2, on Mac OS X 10.15.6 19G2021, locale en-US)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 12.0)
[✓] Android Studio (version 4.0)
[!] Proxy Configuration
! NO_PROXY is not set
[!] Connected device
! No devices available

	- zsh
	- bash
  • 也许还有其他的坑我没有碰到。。。。。

  • 成功

    • Uploading…
      Successfully uploaded package.

XMind - Trial Version

猜你喜欢

转载自blog.csdn.net/u010436133/article/details/108989526