zoukankan      html  css  js  c++  java
  • Flutter问题汇总

         Flutter (Channel stable, v1.17.0, on Linux, locale en_US.UTF-8)
        [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
        [✓] Android Studio (version 3.6)
        [✓] Connected device (1 available)

    1. 编译时 Your app isn't using AndroidX.

      使用AndroidX导致,解决办法:在项目中android目录中的gradle.properties文件加入以下两行代码
      
      android.enableJetifier=true
      android.useAndroidX=true
    2. Compiler message:
      ../../.pub-cache/hosted/pub.flutter-io.cn/cached_network_image-1.1.2/lib/src/cached_network_image_provider.dart:53:24: Error: The method 'CachedNetworkImageProvider.load' has fewer positional arguments than those of overridden method 'ImageProvider.load'.
        ImageStreamCompleter load(CachedNetworkImageProvider key) {
                             ^
      ../../Software/android/sdk/flutter/packages/flutter/lib/src/painting/image_provider.dart:574:24: Context: This is the overridden method ('load').
        ImageStreamCompleter load(T key, DecoderCallback decode);
                             ^
      ../../.pub-cache/hosted/pub.flutter-io.cn/cached_network_image-1.1.2/lib/src/scaled_file_image.dart:45:24: Error: The method 'ScaledFileImage.load' has fewer positional arguments than those of overridden method 'ImageProvider.load'.
        ImageStreamCompleter load(ScaledFileImage key) {
                             ^
      ../../Software/android/sdk/flutter/packages/flutter/lib/src/painting/image_provider.dart:574:24: Context: This is the overridden method ('load').
        ImageStreamCompleter load(T key, DecoderCallback decode);
      解决方案:在pubspec.yaml中修改cached_network_image:1.1.2 为 cached_network_image: 2.0.0-rc
    3. FAILURE: Build failed with an exception.
      
      * What went wrong:
      Execution failed for task ':app:compileDebugKotlin'.
      > Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
         > Could not download arm64_v8a_debug.jar (io.flutter:arm64_v8a_debug:1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90)
            > Could not get resource 'https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90/arm64_v8a_debug-1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90.jar'.
               > Could not HEAD 'https://storage.googleapis.com/download.flutter.io/io/flutter/arm64_v8a_debug/1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90/arm64_v8a_debug-1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90.jar'.
                  > Connect to storage.googleapis.com:443 [storage.googleapis.com/34.64.4.112] failed: connect timed out
         > Could not download x86_debug.jar (io.flutter:x86_debug:1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90)
            > Could not get resource 'https://storage.googleapis.com/download.flutter.io/io/flutter/x86_debug/1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90/x86_debug-1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90.jar'.
               > Could not HEAD 'https://storage.googleapis.com/download.flutter.io/io/flutter/x86_debug/1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90/x86_debug-1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90.jar'.
                  > Connect to storage.googleapis.com:443 [storage.googleapis.com/34.64.4.112] failed: connect timed out
         > Could not download x86_64_debug.jar (io.flutter:x86_64_debug:1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90)
            > Could not get resource 'https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_debug/1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90/x86_64_debug-1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90.jar'.
               > Could not HEAD 'https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_debug/1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90/x86_64_debug-1.0.0-b851c718295a896918dc93cb1ff14f2f895a1b90.jar'.
                  > Connect to storage.googleapis.com:443 [storage.googleapis.com/34.64.4.112] failed: connect timed out
      
      * 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 1m 35s
      Exception: Gradle task assembleDebug failed with exit code 1
      解决方案有两种:

        第一种:在工程.android目录中,对应的build.gradle文件下,添加代码

      “maven { url "http://download.flutter.io" }”后重新编译,如下

      repositories {
      google()
      jcenter()
      maven { url "http://download.flutter.io" }
      }


      第二种:修改flutter sdk中flutter/packages/flutter_tools/gradle/文件夹下三个文件,如下:

      flutter/packages/flutter_tools/gradle/resolve_dependencies.gradle

      flutter/packages/flutter_tools/gradle/aar_init_script.gradle

      flutter/packages/flutter_tools/gradle/flutter.gradle

      中的:https://storage.googleapis.com/download.flutter.io   替换为:http://download.flutter.io 

    4. Hot Reload 热重载失效

      在给 Terminal 之类的终端模拟器设置代理之后,会导致“Hot Reload”重载失效,此时调用 Save (cmd-s / ctrl-s)将不会进行热重载,热重载按钮 (带有闪电⚡️图标的按钮)也不会显示,将代理移除即可解决。
      
      另外,有些情况下热重载是不生效的,比如修改了main函数、修改了全局静态方法等,读者可以认为“Hot Reload”只会重新构建整个widget树,如果变动不在构建widget树的过程中,“Hot Reload”就不会起作用。
    5. 待更新。。。


  • 相关阅读:
    Team Foundation Server 2010
    Visual Studio 2010 建模学习 与TFS工作项进行集成
    Asp.net动态生成页面控件的办法
    信息系统开发平台OpenExpressApp - 学习必备知识
    如何培养一个人:从育儿谈起
    ExtJS 资料
    在asp.net中动态生成web控件1
    团队发展五阶段
    C#动态生成控件以及添加事件处理
    Learn More,Study Less!
  • 原文地址:https://www.cnblogs.com/zgz345/p/12924379.html
Copyright © 2011-2022 走看看