当前位置: 首页 > 知识库问答 >
问题:

Flutter插件image_picker和flutter_quill TLS错误?

卫松
2024-04-15

前几天好好的flutter项目在自己的电脑上突然不能下载部分依赖了,明明都是同样的环境配置,同事的电脑没问题,自己家的电脑运行也没问题,问题就出在image_picker这个插件上,一直提示

Got TLS error trying to find package flutter_plugin_android_lifecycle at https://pub.flutter-io.cn

除了这个插件,flutter_quill也是同样的问题,

Got TLS error trying to find package html2md at https://pub.flutter-io.cn

只是提示不同。现在就是只能屏蔽这两个插件,相关的页面暂时不去碰。

网上查询了很多,内外网都查了,查到的几个方法也不行,尝试了以下方法,

  • 修改镜像源,改了清华和交大的源,也不行,很奇怪的一点是,在项目文件夹内通过powershell运行pub get,连接到的是修改后的源,但是在vscode或者AS中,连接的还是修改前的https://pub.flutter-io.cn,清除了缓存也没变。另外,使用清华源提示

    Flutter assets will be downloaded from https://mirrors.tuna.tsinghua.edu.cn/flutter. Make sure you trust this source!FAILURE: Build failed with an exception.
  • What went wrong:
    Execution failed for task ':device_info_plus:compileDebugJavaWithJavac'.

    ����: ��Ч��Դ���а棺17
  • Try:

    Run with --stacktrace option to get the stack trace.
    Run with --info or --debug option to get more log output.
    Run with --scan to get full insights.
  • Get more help at https://help.gradle.org

    BUILD FAILED in 37s
    Running Gradle task 'assembleDebug'... 37.7s
    Error: Gradle task assembleDebug failed with exit code 1

    使用交大源提示 
Flutter assets will be downloaded from https://mirror.sjtu.edu.cn. Make sure you trust this source!Resolving dependencies... (3.0s)Downloaded archive for shared_preferences_android-2.2.1 had wrong content-hash.This indicates a problem on the package repository: `https://mirror.sjtu.edu.cn/dart-pub/`.See https://dart.dev/go/content-hashes.package:pub/src/source/hosted.dart 1368:7   HostedSource._throwFriendlyErrorpackage:pub/src/source/hosted.dart 1195:9   HostedSource._download.<fn>===== asynchronous gap ===========================package:pub/src/io.dart 985:12              withTempDir===== asynchronous gap ===========================package:pub/src/source/hosted.dart 1122:12  HostedSource._download===== asynchronous gap ===========================package:pub/src/source/hosted.dart 871:21   HostedSource.downloadToSystemCache===== asynchronous gap ===========================package:pub/src/system_cache.dart 239:20    SystemCache.downloadPackage===== asynchronous gap ===========================package:pub/src/solver/result.dart 71:21    SolveResult.downloadCachedPackages.<fn>.<fn>===== asynchronous gap ===========================package:pub/src/solver/result.dart 69:18    SolveResult.downloadCachedPackages.<fn>===== asynchronous gap ===========================package:pub/src/solver/result.dart 66:32    SolveResult.downloadCachedPackages===== asynchronous gap ===========================package:pub/src/entrypoint.dart 380:25      Entrypoint.acquireDependencies===== asynchronous gap ===========================package:pub/src/command/get.dart 77:5       GetCommand.runProtectedThis is an unexpected error. The full log and other details are collected in:
  • 防火墙什么的也给关了测试了。
  • 系统也添加了pub的pem证书,DART_VM_OPTIONS也配置了。
  • 电脑连接手机热点进行下载。

我现在甚至想重装系统了,但是重装的代价太大,是否有人碰到过类似问题,如何解决的呢。

以下是系统信息:

系统:windows10 22H2flutter版本: 3.19.5dart版本:3.3.3

以下是yaml部分配置信息:

# The following line prevents the package from being accidentally published to# pub.dev using `flutter pub publish`. This is preferred for private packages.publish_to: 'none' # Remove this line if you wish to publish to pub.dev# The following defines the version and build number for your application.# A version number is three numbers separated by dots, like 1.2.43# followed by an optional build number separated by a +.# Both the version and the builder number may be overridden in flutter# build by specifying --build-name and --build-number, respectively.# In Android, build-name is used as versionName while build-number used as versionCode.# Read more about Android versioning at https://developer.android.com/studio/publish/versioning# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.# Read more about iOS versioning at# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html# In Windows, build-name is used as the major, minor, and patch parts# of the product and file versions while build-number is used as the build suffix.version: 1.0.0+1environment:  sdk: '>=3.2.5 <4.0.0'# Dependencies specify other packages that your package needs in order to work.# To automatically upgrade your package dependencies to the latest versions# consider running `flutter pub upgrade --major-versions`. Alternatively,# dependencies can be manually updated by changing the version numbers below to# the latest version available on pub.dev. To see which dependencies have newer# versions available, run `flutter pub outdated`.dependencies:  flutter:    sdk: flutter  dio: ^5.4.1  # The following adds the Cupertino Icons font to your application.  # Use with the CupertinoIcons class for iOS style icons.  cupertino_icons: ^1.0.2  bottom_bar_matu: ^1.3.1  salomon_bottom_bar: ^3.3.2  modal_bottom_sheet: ^3.0.0-pre  get: ^4.6.6  shared_preferences: ^2.2.2  bottom_navy_bar: ^6.0.0  convex_bottom_bar: ^3.2.0  flutter_staggered_grid_view: ^0.7.0  easy_refresh: ^3.3.4  flutter_spinkit: ^5.2.0  badges: ^3.1.2  flutter_im_list: ^1.0.0  cached_network_image: ^3.3.1  card_swiper: ^3.0.1  photo_view: ^0.14.0  like_button: ^2.0.5  # image_picker: ^1.0.7  bruno: ^3.4.3  qr_flutter: ^4.1.0  font_awesome_flutter: ^10.7.0  table_calendar: ^3.0.9  fluwx: ^4.5.5  tencent_kit: ^6.0.1  flutter_cache_manager: ^3.3.1  flutter_quill: ^9.3.0  # The following adds the Cupertino Icons font to your application.  # Use with the CupertinoIcons class for iOS style icons.dev_dependencies:  flutter_test:    sdk: flutter  # The "flutter_lints" package below contains a set of recommended lints to  # encourage good coding practices. The lint set provided by the package is  # activated in the `analysis_options.yaml` file located at the root of your  # package. See that file for information about deactivating specific lint  # rules and activating additional ones.  flutter_lints: ^2.0.0# For information on the generic Dart part of this file, see the# following page: https://dart.dev/tools/pub/pubspec# The following section is specific to Flutter packages.flutter:  # The following line ensures that the Material Icons font is  # included with your application, so that you can use the icons in  # the material Icons class.  uses-material-design: true  # To add assets to your application, add an assets section, like this:  assets:    - assets/image/    - assets/icons/  # An image asset can refer to one or more resolution-specific "variants", see  # https://flutter.dev/assets-and-images/#resolution-aware  # For details regarding adding assets from package dependencies, see  # https://flutter.dev/assets-and-images/#from-packages  # To add custom fonts to your application, add a fonts section here,  # in this "flutter" section. Each entry in this list should have a  # "family" key with the font family name, and a "fonts" key with a  # list giving the asset and other descriptors for the font. For  # example:  # fonts:  #   - family: Schyler  #     fonts:  #       - asset: fonts/Schyler-Regular.ttf  #       - asset: fonts/Schyler-Italic.ttf  #         style: italic  #   - family: Trajan Pro  #     fonts:  #       - asset: fonts/TrajanPro.ttf  #       - asset: fonts/TrajanPro_Bold.ttf  #         weight: 700  #  # For details regarding fonts from package dependencies,  # see https://flutter.dev/custom-fonts/#from-packages

共有1个答案

齐宗清
2024-04-15

从你提供的错误信息来看,问题似乎与Flutter插件的TLS连接有关。这可能是由于网络问题、代理设置、证书问题等导致的。下面是一些可能的解决步骤:

  1. 检查网络连接:确保你的网络连接稳定,并且没有被防火墙或其他安全软件阻止。
  2. 更换Flutter源:由于你提到修改镜像源后问题依旧存在,可以尝试更换为其他可靠的源,例如阿里云、七牛云等。
  3. 检查代理设置:如果你在使用代理,请确保代理设置正确,并且代理服务器可以访问到Flutter的仓库。
  4. 检查证书问题:你提到已经添加了pub的pem证书,并配置了DART_VM_OPTIONS,但问题仍然存在。可以尝试重新下载证书,并确保配置正确。
  5. 清除缓存和构建文件:尝试清除Flutter的缓存和构建文件,然后重新运行flutter pub get。可以使用以下命令清除缓存:
flutter cleanflutter pub cache repair
  1. 更新Flutter和Dart版本:你提到Flutter版本为3.19.5,Dart版本为3.3.3。可以尝试更新到最新版本,看看问题是否得到解决。
  2. 尝试在其他环境中运行:如果以上步骤都无法解决问题,可以尝试在其他电脑或环境中运行你的项目,看看问题是否依旧存在。这有助于确定问题是否与特定环境有关。

如果以上步骤都无法解决问题,可能需要更深入地检查你的网络设置和Flutter配置。在这种情况下,考虑寻求Flutter社区或专业开发者的帮助可能是一个好的选择。

 类似资料:
  • 两个插件都已安装,但无法访问android studio中的插件,即使安装了也显示以下错误

  • 在将image_picker:^0.6.7+9添加到pubspec.yaml文件后出现了此错误,并且我已经在AndroidX中了,因为我的Android/gradle.properties文件具有AndroidX属性,如本文档“https://flutter.dev/docs/development/AndroidX-migration”中所述。 但我还是得到了这个错误,在搜索和尝试了几个小时的解

  • 我在我的应用程序中使用HMS核心插件(Huawei Location Kit),在调试模式下一切正常,但当我打开它的发布模式时,它抛出了以下错误,尽管我可以正常访问Huawei Location Kit: 我不知道是什么引起了这个问题。有什么想法吗?

  • 我想我有这个链接中提到的同样的问题,flutter和dart插件都安装好了,我试图卸载并再次安装插件,但flutter医生给了我。 知道如何解决这个问题吗?谢谢。

  • 我正在尝试在ubuntu上安装flutter,android studio flutter和dart插件已经安装,但是说没有安装。一开始,即使安装了flutter doctor也找不到我的android studio和sdk,然后通过使用以下命令配置android studio和sdk的自定义目录来解决这个问题:,但是找不到任何解决方案如何显示flutter doctor的android stud

  • 我在play商店上传了我的应用程序,但是当我为flutter应用程序创建IPA时,我收到了以下两个错误: 未处理的异常:MissingPluginException(在通道Ponnam Karthik/Flutter toast上找不到方法showToast的实现)