【错误记录】发布 Flutter 插件包报错 ( Failed to upload the package.pub finished with exit code 1 )

简介: 【错误记录】发布 Flutter 插件包报错 ( Failed to upload the package.pub finished with exit code 1 )

文章目录

一、报错信息

二、解决方案





一、报错信息


发布插件包 , 确认发布 , 校验了 Google 账号 , 之后报错如下 :


Failed to upload the package.
pub finished with exit code 1


完整报错信息 :


D:\002_Project\002_Android_Learn\flutter_package>flutter packages pub publish
Publishing flutter_package 0.0.1 to https://pub.flutter-io.cn:
|-- .gitignore
|-- .metadata
|-- CHANGELOG.md
|-- LICENSE
|-- README.md
|-- lib
|   '-- flutter_package.dart
|-- pubspec.yaml
'-- test
    '-- flutter_package_test.dart
Publishing is forever; packages cannot be unpublished.
Policy details are available at https://pub.dev/policy
Do you want to publish flutter_package 0.0.1 (y/N)? y
Uploading...
Failed to upload the package.
pub finished with exit code 1


使用


flutter packages pub publish -v


命令 , 执行后 , 会打印出更加详细的日志信息 ;


image.png


详细报错信息 :


FINE: Uploading finished (0.642s).
FINE: Saving OAuth2 credentials.
IO  : Writing 1381 characters to text file D:\001_Develop\010_Flutter\flutter_windows_2.2.3-stable\flutter\.pub-cache\credentials.json.
ERR : Failed to upload the package.
FINE: Exception type: ApplicationException
FINE: package:pub/src/utils.dart 512:5                                                      fail
    | package:pub/src/command/lish.dart 109:9                                               LishCommand._publish
    | ===== asynchronous gap ===========================
    | dart:async                                                                            Future.catchError
    | package:pub/src/utils.dart 113:52                                                     captureErrors.wrappedCallback
    | package:stack_trace                                                                   Chain.capture
    | package:pub/src/utils.dart 126:11                                                     captureErrors
    | package:pub/src/command.dart 164:13                                                   PubCommand.run
    | package:args/command_runner.dart 196:27                                               CommandRunner.runCommand
    | package:pub/src/command_runner.dart 150:26                                            PubCommandRunner.runCommand
    | package:pub/src/command_runner.dart 138:18                                            PubCommandRunner.run
    | C:\b\s\w\ir\cache\builder\src\third_party\dart\third_party\pkg\pub\bin\pub.dart 9:48  main
[+11046 ms] "flutter pub" took 11,127ms.
[   +4 ms] pub finished with exit code 1
[   +1 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      _DefaultPub.interactively (package:flutter_tools/src/dart/pub.dart:368:7)
           <asynchronous suspension>
           <asynchronous suspension>
           #3      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1043:27)
           <asynchronous suspension>
           #4      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #5      CommandRunner.runCommand (package:args/command_runner.dart:196:13)
           <asynchronous suspension>
           #6      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:284:9)
           <asynchronous suspension>
           #7      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #8      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:232:5)
           <asynchronous suspension>
           #9      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #10     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #11     main (package:flutter_tools/executable.dart:91:3)
           <asynchronous suspension>
[ +258 ms] ensureAnalyticsSent: 257ms
[   +3 ms] Running shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 1
D:\002_Project\002_Android_Learn\flutter_package>






二、解决方案


由于设置了 Flutter 镜像导致 ;


PUB_HOSTED_URL : https://pub.flutter-io.cn

FLUTTER_STORAGE_BASE_URL : https://storage.flutter-io.cn


从环境变量中移除上述两个镜像 ;



再使用如下命令 , 向 Flutter 中央仓库推送 Dart 包 ;


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


终于上传成功了 :


D:\002_Project\002_Android_Learn\flutter_package>flutter packages pub publish --server=https://pub.dartlang.org
Publishing flutter_package_first_demo 0.0.1 to https://pub.dartlang.org:
|-- .gitignore
|-- .metadata
|-- CHANGELOG.md
|-- LICENSE
|-- README.md
|-- lib
|   '-- flutter_package_first_demo.dart
|-- pubspec.yaml
'-- test
    '-- flutter_package_test.dart
Publishing is forever; packages cannot be unpublished.
Policy details are available at https://pub.dev/policy
Do you want to publish flutter_package_first_demo 0.0.1 (y/N)? y
Uploading...
Successfully uploaded package.
D:\002_Project\002_Android_Learn\flutter_package>



image.pngimage.pngimage.pngimage.pngimage.pngimage.pngimage.pngimage.pngimage.pngimage.pngimage.pngimage.pngimage.pngimage.pngimage.pngimage.pngimage.pngimage.pngimage.pngimage.pngimage.png

image.png

目录
相关文章
|
2月前
|
Dart Android开发
鸿蒙Flutter实战:05-使用第三方插件
在鸿蒙Flutter开发中,使用原生功能需借助插件。可自编原生ArkTS代码或采用第三方插件。自编代码通过PlatformView或MethodChannel实现;第三方插件需确保适配鸿蒙,否则须配置替代插件或自行开发。
96 1
鸿蒙Flutter实战:05-使用第三方插件
|
7天前
|
Dart
Flutter 快捷键 和 插件使用
Flutter 快捷键 和 插件使用
Flutter 快捷键 和 插件使用
|
1月前
|
传感器 前端开发 Android开发
在 Flutter 开发中,插件开发与集成至关重要,它能扩展应用功能,满足复杂业务需求
在 Flutter 开发中,插件开发与集成至关重要,它能扩展应用功能,满足复杂业务需求。本文深入探讨了插件开发的基本概念、流程、集成方法、常见类型及开发实例,如相机插件的开发步骤,同时强调了版本兼容性、性能优化等注意事项,并展望了插件开发的未来趋势。
41 2
|
1月前
|
存储 测试技术 Shell
Flutter UT太多导致跑覆盖率报错
Flutter UT太多导致跑覆盖率报错
29 2
|
2月前
|
编解码 Dart API
鸿蒙Flutter实战:06-使用ArkTs开发Flutter鸿蒙插件
本文介绍了如何开发一个 Flutter 鸿蒙插件,实现 Flutter 与鸿蒙的混合开发及双端消息通信。通过定义 `MethodChannel` 实现 Flutter 侧的 token 存取方法,并在鸿蒙侧编写 `EntryAbility` 和 `ForestPlugin`,使用鸿蒙的首选项 API 完成数据的读写操作。文章还提供了注意事项和参考资料,帮助开发者更好地理解和实现这一过程。
120 0
|
4月前
|
开发工具 iOS开发
解决Flutter运行报错Could not run build/ios/iphoneos/Runner.app
解决Flutter运行报错Could not run build/ios/iphoneos/Runner.app
191 2
|
4月前
解决Flutter报错boxconstraints has non-normalized height/width constraints
解决Flutter报错boxconstraints has non-normalized height/width constraints
57 0
|
开发工具
【错误记录】Flutter 插件报错 ( Methods marked with @UiThread must be executed on the main thread. | 更新最新 SDK )(一)
【错误记录】Flutter 插件报错 ( Methods marked with @UiThread must be executed on the main thread. | 更新最新 SDK )(一)
868 0
【错误记录】Flutter 插件报错 ( Methods marked with @UiThread must be executed on the main thread. | 更新最新 SDK )(一)
|
开发工具
【错误记录】Flutter 插件报错 ( Methods marked with @UiThread must be executed on the main thread. | 更新最新 SDK )(二)
【错误记录】Flutter 插件报错 ( Methods marked with @UiThread must be executed on the main thread. | 更新最新 SDK )(二)
339 0
【错误记录】Flutter 插件报错 ( Methods marked with @UiThread must be executed on the main thread. | 更新最新 SDK )(二)
|
2月前
|
Android开发 iOS开发 容器
鸿蒙harmonyos next flutter混合开发之开发FFI plugin
鸿蒙harmonyos next flutter混合开发之开发FFI plugin