V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
aboutboy
V2EX  ›  Flutter

请教一个 flutter 开源项目的编译问题,小偿

  •  
  •   aboutboy · 250 天前 · 1082 次点击
    这是一个创建于 250 天前的主题,其中的信息可能已经有所发展或是发生改变。

    项目地址: https://github.com/wootzapp/wootz-browser , 因为我想开发一款浏览器,想在这个代码基础上改。 电脑上搭建了开发环境,但是可能 gradle 或 jdk 哪里配置有问题,编译失败。

    希望高手能指点一二,教我编译成功,如果帮我编译成功,愿打赏 100 红包(但愿大佬看到这里不要因为嫌弃就不理我了,呜呜)。 如果有高手感兴趣,也可以外包帮我开发一下,增加一些小功能(预算 1w 以内,看完成程度有浮动)。

    微信(base64 ,请自行 unbase64):d2F5c2Nu

    17 条回复    2024-04-07 15:16:45 +08:00
    jifengg
        1
    jifengg  
       249 天前
    确实,用 flutter 就得能搞定网络环境。拉了代码在编译,遇到几个问题已经解决了,等编译完了再来回复。
    aboutboy
        2
    aboutboy  
    OP
       249 天前
    @jifengg 感谢。搞定加我微信
    jifengg
        3
    jifengg  
       249 天前
    Flutter 3.7.12
    Android Studio (version 2022.2),自带的 jdk 版本 17.0.6
    Android SDK version 34.0.0

    #去掉了 flutter 国内代理,为了保证所有包版本均和 lock 一致
    set PUB_HOSTED_URL=
    set FLUTTER_STORAGE_BASE_URL=


    安卓编译 ok ,期间修复了 项目使用的 gradle6.8 与 jdk 版本不符的问题
    aboutboy
        4
    aboutboy  
    OP
       248 天前
    @jifengg 大佬,可加我微信
    aboutboy
        5
    aboutboy  
    OP
       247 天前
    @jifengg 我这边还是不能编译成功,麻烦可以加我微信指导下吗?
    jifengg
        6
    jifengg  
       246 天前
    @aboutboy 你可以先把你遇到的错误贴出来。
    flutter run -v
    执行以上命令,把 error 的信息发出来。
    如果有其他人也碰到相同问题也可以参考参考。
    aboutboy
        7
    aboutboy  
    OP
       246 天前
    @jifengg 麻烦大佬看看。。大佬可否 github fork 这个项目,帮我写一个小白能看懂的编译教程,开通打赏。不然我实在不好意思总是麻烦大佬

    PS C:\Users\lce\Downloads\wootz-browser-up-browser> flutter run -v
    [ +165 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
    [ +1 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
    [ ] Artifact Instance of 'LegacyCanvasKitRemover' is not required, skipping update.
    [ +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
    [ +74 ms] Connected devices:
    [ +48 ms] Chrome (web) • chrome • web-javascript • Google Chrome 123.0.6312.86
    [ +1 ms] Edge (web) • edge • web-javascript • Microsoft Edge 123.0.2420.65
    [ ] [1]: Chrome (chrome)
    [ ] [2]: Edge (edge)
    [ +1 ms] Please choose one (or "q" to quit)
    [ ] :
    [+178655 ms]
    [ +1 ms] Please choose one (or "q" to quit)
    [ +1 ms] :
    [+6383 ms] 1
    [ +11 ms] Initializing file store
    [ +2 ms] Done initializing file store
    [ +23 ms] Skipping target: gen_localizations
    [ +1 ms] Persisting file store
    [ +3 ms] Done persisting file store
    [ +6 ms] Skipping pub get: version match.
    [ +44 ms] Found plugin flutter_inappwebview at C:\Users\lce\AppData\Local\Pub\Cache\hosted\pub.flutter-io.cn\flutter_inappwebview-6.0.0-beta.21\
    [ +99 ms] Found plugin flutter_inappwebview at C:\Users\lce\AppData\Local\Pub\Cache\hosted\pub.flutter-io.cn\flutter_inappwebview-6.0.0-beta.21\
    [ +72 ms] Found plugin flutter_inappwebview at C:\Users\lce\AppData\Local\Pub\Cache\hosted\pub.flutter-io.cn\flutter_inappwebview-6.0.0-beta.21\
    [ +105 ms] Generating C:\Users\lce\Downloads\wootz-browser-up-browser\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java
    [ +69 ms] Launching lib\main.dart on Chrome in debug mode...
    [ +106 ms] Initializing file store
    [ +2 ms] gen_localizations: Starting due to {}
    [ +128 ms] Skipping target: gen_dart_plugin_registrant
    [ +6 ms] gen_localizations: Complete
    [ +8 ms] _composite: Starting due to {}
    [ ] _composite: Complete
    [ +2 ms] complete
    [ +1 ms] Updating assets
    [ +44 ms] Error detected in pubspec.yaml:
    [ ] No file or variants found for asset: assets/speedometer.webp.

    [ +2 ms] Failed to compile application.
    [ +9 ms] "flutter run" took 186,098ms.
    [ +3 ms]
    #0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
    #1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:752:9)
    <asynchronous suspension>
    #2 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1350:27)
    <asynchronous suspension>
    #3 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
    <asynchronous suspension>
    #4 CommandRunner.runCommand (package:args/command_runner.dart:212:13)
    <asynchronous suspension>
    #5 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:348:9)
    <asynchronous suspension>
    #6 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
    <asynchronous suspension>
    #7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:294:5)
    <asynchronous suspension>
    #8 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:112:9)
    <asynchronous suspension>
    #9 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
    <asynchronous suspension>
    #10 main (package:flutter_tools/executable.dart:90:3)
    <asynchronous suspension>


    [ +268 ms] ensureAnalyticsSent: 263ms
    [ +1 ms] Running 1 shutdown hook
    [ +1 ms] Shutdown hooks complete
    [ ] exiting with code 1



    ------------------------------------------------------------------

    C:\Users\lce\Downloads\flutter\bin\flutter.bat --no-color build apk

    Running Gradle task 'assembleRelease'...

    FAILURE: Build failed with an exception.

    * Where:
    Build file 'C:\Users\lce\Downloads\wootz-browser-up-browser\android\build.gradle' line: 27

    * What went wrong:
    A problem occurred evaluating root project 'android'.
    > A problem occurred configuring project ':app'.
    > Could not open proj generic class cache for build file 'C:\Users\lce\Downloads\wootz-browser-up-browser\android\app\build.gradle' (C:\Users\lce\.gradle\caches\6.8\scripts\2qmxpn79oie3wctwqhuplb01k).
    > BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 61

    * 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 1s
    Running Gradle task 'assembleRelease'... 2,117ms

    ┌─ Flutter Fix ────────────────────────────────────────────────────────────────────────────────────┐
    │ [!] Your project's Gradle version is incompatible with the Java version that Flutter is using │
    │ for Gradle. │
    │ │
    │ To fix this issue, consult the migration guide at docs.flutter.dev/go/android-java-gradle-error. │
    └──────────────────────────────────────────────────────────────────────────────────────────────────┘
    Gradle task assembleRelease failed with exit code 1
    Process finished with exit code 1
    jifengg
        8
    jifengg  
       245 天前
    ```
    [ +44 ms] Error detected in pubspec.yaml:
    [ ] No file or variants found for asset: assets/speedometer.webp
    ```

    你这个 flutter run 报错缺少这个文件,它应该是这个项目 wootz-browser\youtube_player_flutter 里的,你代码是用 git clone 拉下来的么,怎么会缺少这个文件
    aboutboy
        9
    aboutboy  
    OP
       244 天前
    @jifengg 不清楚为什么。今天去看这个项目,好像代码不一样了
    aboutboy
        10
    aboutboy  
    OP
       244 天前
    @jifengg

    PS C:\Users\lce\Downloads\wootz-browser-up-browser-new> flutter run -v
    [ +162 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
    [ +1 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
    [ ] Artifact Instance of 'LegacyCanvasKitRemover' is not required, skipping update.
    [ +2 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
    [ +54 ms] executing: C:\Users\lce\AppData\Local\Android\Sdk\platform-tools\adb.exe devices -l
    [ +66 ms] List of devices attached
    [ +7 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
    [ +7 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
    [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
    [ +71 ms] Connected devices:
    [ +45 ms] Chrome (web) • chrome • web-javascript • Google Chrome 123.0.6312.86
    [ +1 ms] Edge (web) • edge • web-javascript • Microsoft Edge 123.0.2420.65
    [ ] [1]: Chrome (chrome)
    [ ] [2]: Edge (edge)
    [ +1 ms] Please choose one (or "q" to quit)
    [ ] :
    [+2694 ms] 1
    [ +18 ms] Initializing file store
    [ +1 ms] Done initializing file store
    [ +11 ms] gen_localizations: Starting due to {}
    [ +10 ms] Persisting file store
    [ +2 ms] Done persisting file store
    [ +10 ms] "flutter run" took 3,040ms.
    [ +19 ms] Generating synthetic localizations package failed with 1 error:

    Exception: Attempted to generate localizations code without having the flutter: generate flag turned on.
    Check pubspec.yaml and ensure that flutter: generate: true has been added and rebuild the project. Otherwise, the localizations source code will not be importable.
    [ +2 ms]
    #0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
    #1 generateLocalizationsSyntheticPackage (package:flutter_tools/src/dart/generate_synthetic_packages.dart:62:5)
    <asynchronous suspension>
    #2 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1638:7)
    <asynchronous suspension>
    #3 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1350: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:212:13)
    <asynchronous suspension>
    #6 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:348: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:90:3)
    <asynchronous suspension>


    [ +258 ms] ensureAnalyticsSent: 251ms
    [ ] Running 0 shutdown hooks
    [ ] Shutdown hooks complete
    [ ] exiting with code 1
    PS C:\Users\lce\Downloads\wootz-browser-up-browser-new>



    大佬,我重新拉了一份,flutter run -v 提示如上
    aboutboy
        11
    aboutboy  
    OP
       244 天前
    抱歉,我实在小白,上面的我研究了下,在 pubspec.yaml 文件 flutter 节点添加 generate: true ,解决了上面的问题。

    新的 flutter run -v 提示如下:
    ...
    IO : Writing 3049269 characters to text file C:\Users\lce\AppData\Local\Pub\Cache\log\pub_log.txt.
    MSG : Logs written to C:\Users\lce\AppData\Local\Pub\Cache\log\pub_log.txt.
    [+15294 ms] Found plugin flutter_inappwebview at C:\Users\lce\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_inappwebview-6.0.0-beta.21\
    [ +201 ms] Found plugin flutter_inappwebview at C:\Users\lce\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_inappwebview-6.0.0-beta.21\
    [ +126 ms] Found plugin flutter_inappwebview at C:\Users\lce\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_inappwebview-6.0.0-beta.21\
    [ +165 ms] Generating C:\Users\lce\Downloads\wootz-browser-up-browser-new\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java
    [ +67 ms] Launching lib\main.dart on Chrome in debug mode...
    [ +95 ms] Initializing file store
    [ +3 ms] gen_localizations: Starting due to {}
    [ +73 ms] Skipping target: gen_dart_plugin_registrant
    [ +12 ms] gen_localizations: Complete
    [ +17 ms] _composite: Starting due to {}
    [ ] _composite: Complete
    [ +6 ms] complete
    [ +2 ms] Updating assets
    [ +91 ms] Error detected in pubspec.yaml:
    [ +1 ms] No file or variants found for asset: assets/speedometer.webp.

    [ +2 ms] Failed to compile application.
    [ +11 ms] "flutter run" took 17,918ms.
    [ +6 ms]
    #0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
    #1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:752:9)
    <asynchronous suspension>
    #2 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1350:27)
    <asynchronous suspension>
    #3 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
    <asynchronous suspension>
    #4 CommandRunner.runCommand (package:args/command_runner.dart:212:13)
    <asynchronous suspension>
    #5 FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:348:9)
    <asynchronous suspension>
    #6 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
    <asynchronous suspension>
    #7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:294:5)
    <asynchronous suspension>
    #8 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:112:9)
    <asynchronous suspension>
    #9 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
    <asynchronous suspension>
    #10 main (package:flutter_tools/executable.dart:90:3)
    <asynchronous suspension>


    [ +243 ms] ensureAnalyticsSent: 232ms
    [ +1 ms] Running 1 shutdown hook
    [ +2 ms] Shutdown hooks complete
    [ ] exiting with code 1
    aboutboy
        12
    aboutboy  
    OP
       244 天前
    上面的提示和之前的一样。。

    不过我现在越来越明了一点,我看了 pubspec.yaml 文件,最后的配置是:
    assets:
    - assets/speedometer.webp

    我看文件夹确实没有 assets/speedometer.webp 这个文件
    jifengg
        13
    jifengg  
       244 天前
    你这,用的是 https://github.com/wootzapp/wootz-browser/tree/up-browser 这个分支吗?你要不要考虑重新拉一份?他文件不缺
    jifengg
        14
    jifengg  
       244 天前
    我建议你,重新拉一份代码,确定分支,啥都别改,直接编译,能编译成功再说。
    aboutboy
        15
    aboutboy  
    OP
       243 天前
    @jifengg 大佬,我之前环境配置有点问题,现在安装了 flutter sdk 3.7.12 的版本,同时也配置了 android api 34 的 device ,重新运行 flutter run -v ,日志有点多,我只贴红色部分:


    [ +1 ms] Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
    [ +2 ms] Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
    [ +1 ms] Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
    [ ] Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
    [ ] Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
    [ ] Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
    [ ] Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
    [ ] Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
    [ ] Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
    [ ] Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
    [ ] Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
    [ ] Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
    [ ] Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
    [ ] Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
    [ ] Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
    [ ] Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01




    [ +1 ms] [ +282 ms] Error: Couldn't resolve the package 'cryptowallet' in 'package:cryptowallet/screens/open_app_pin_failed.dart'.
    [ ] [ +1 ms] Error: Couldn't resolve the package 'cryptowallet' in 'package:cryptowallet/utils/app_config.dart'.
    [ ] [ ] Error: Couldn't resolve the package 'cryptowallet' in 'package:cryptowallet/utils/navigator_service.dart'.
    [ ] [ ] Error: Couldn't resolve the package 'cryptowallet' in 'package:cryptowallet/utils/rpc_urls.dart'.
    [ ] [ ] Error: Couldn't resolve the package 'cryptowallet' in 'package:cryptowallet/utils/wc_connector.dart'.
    [ ] [ ] Error: Couldn't resolve the package 'cryptowallet' in 'package:cryptowallet/models/browser_model.dart'.
    [ ] [ ] Error: Couldn't resolve the package 'cryptowallet' in 'package:cryptowallet/models/webview_model.dart'.
    [ ] [ ] Error: Couldn't resolve the package 'flutter_downloader' in 'package:flutter_downloader/flutter_downloader.dart'.
    [ ] [ ] Error: Couldn't resolve the package 'flutter_phoenix' in 'package:flutter_phoenix/flutter_phoenix.dart'.
    [ ] [ ] Error: Couldn't resolve the package 'flutter_secure_storage' in 'package:flutter_secure_storage/flutter_secure_storage.dart'.
    [ ] [ ] Error: Couldn't resolve the package 'hive' in 'package:hive/hive.dart'.
    [ ] [ ] Error: Couldn't resolve the package 'hive_flutter' in 'package:hive_flutter/hive_flutter.dart'.
    [ ] [ ] Error: Couldn't resolve the package 'multi_value_listenable_builder' in 'package:multi_value_listenable_builder/multi_value_listenable_builder.dart'.
    [ ] [ ] Error: Couldn't resolve the package 'path_provider' in 'package:path_provider/path_provider.dart'.
    [ ] [ ] Error: Couldn't resolve the package 'permission_handler' in 'package:permission_handler/permission_handler.dart'.
    [ ] [ ] Error: Couldn't resolve the package 'provider' in 'package:provider/provider.dart'.
    [ ] [ +6 ms] lib/main.dart:3:8: Error: Not found: 'package:cryptowallet/screens/open_app_pin_failed.dart'
    [ ] [ ] import 'package:cryptowallet/screens/open_app_pin_failed.dart';
    [ ] [ ] ^
    [ ] [ +6 ms] lib/main.dart:4:8: Error: Not found: 'package:cryptowallet/utils/app_config.dart'
    [ ] [ ] import 'package:cryptowallet/utils/app_config.dart';

    [ +181 ms] [ +614 ms] lib/models/provider.dart:6:14: Error: Undefined name 'Hive'.
    [ ] [ ] final pref = Hive.box(secureStorageKey);
    [ +1 ms] [ ] ^^^^
    [ +187 ms] [ +220 ms] lib/custom_popup_menu_item.dart:28:21: Error: The parameter 'value' of the method 'CustomPopupMenuItem.represents' has type 'T', which does not match the
    corresponding type, 'T?', in the overridden method, 'PopupMenuEntry.represents'.
    [ +1 ms] [ ] Change to a supertype of 'T?', or, for a covariant parameter, a subtype.
    [ ] [ ] bool represents(T value) => value == this.value;
    [ ] [ ] ^
    [ ] [ ] ../flutter_windows_3.7.12-stable/flutter/packages/flutter/lib/src/material/popup_menu.dart:89:8: Context: This is the overridden method ('represents').
    [ ] [ ] bool represents(T? value);
    [ ] [ ] ^
    [ +297 ms] [ +223 ms] .dart_tool/flutter_gen/gen_l10n/app_localization.dart:86:5: Error: Undefined name 'GlobalMaterialLocalizations'.
    [ ] [ ] GlobalMaterialLocalizations.delegate,
    [ ] [ ] ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [ ] [ ] .dart_tool/flutter_gen/gen_l10n/app_localization.dart:87:5: Error: Undefined name 'GlobalCupertinoLocalizations'.
    [ ] [ ] GlobalCupertinoLocalizations.delegate,
    [ ] [ ] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [ ] [ ] .dart_tool/flutter_gen/gen_l10n/app_localization.dart:88:5: Error: Undefined name 'GlobalWidgetsLocalizations'.
    [ ] [ ] GlobalWidgetsLocalizations.delegate,
    [ ] [ ] ^^^^^^^^^^^^^^^^^^^^^^^^^^



    [ ] FAILURE: Build failed with an exception.
    [ ] * Where:
    [ ] Script 'C:\Users\lce\Downloads\flutter_windows_3.7.12-stable\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1157
    [ ] * What went wrong:
    [ ] Execution failed for task ':app:compileFlutterBuildDebug'.
    [ ] > Process 'command 'C:\Users\lce\Downloads\flutter_windows_3.7.12-stable\flutter\bin\flutter.bat'' finished with non-zero exit value 1
    [ ] * Try:
    [ ] Run with --debug option to get more log output. Run with --scan to get full insights.
    [ ] * Exception is:
    [ ] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileFlutterBuildDebug'.
    [ ] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$3(ExecuteActionsTaskExecuter.java:186)
    [ ] at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:268)




    [ +3 ms] Exception: Gradle task assembleDebug failed with exit code 1
    [ +4 ms] "flutter run" took 17,732ms.
    [ +3 ms]
    #0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
    #1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:722:9)
    <asynchronous suspension>
    #2 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1257:27)
    <asynchronous suspension>
    #6 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
    <asynchronous suspension>
    #7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
    <asynchronous suspension>
    #8 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:64:9)
    <asynchronous suspension>
    #9 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
    <asynchronous suspension>
    #10 main (package:flutter_tools/executable.dart:91:3)
    <asynchronous suspension>
    jifengg
        16
    jifengg  
       240 天前
    看关键信息“Couldn't resolve the package”,包没装上。
    可以先运行
    flutter pub get
    看看哪些包安装的有问题。另外,如果是在国内,可能安装包会网络问题失败,给设置到 网络代理 http_proxy ,不要设置 PUB_HOSTED_URL 环境变量
    aboutboy
        17
    aboutboy  
    OP
       240 天前
    @jifengg

    PS C:\Users\lce\Downloads\wootz-browser-up-browser-new> flutter pub get
    Running "flutter pub get" in wootz-browser-up-browser-new...
    Resolving dependencies... (1.5s)
    _fe_analyzer_shared 61.0.0 (67.0.0 available)
    analyzer 5.13.0 (6.4.1 available)
    args 2.3.1 (2.4.2 available)
    async 2.10.0 (2.11.0 available)
    characters 1.2.1 (1.3.0 available)
    collection 1.17.0 (1.18.0 available)
    convert 3.0.2 (3.1.1 available)
    coverage 1.6.3 (1.7.2 available)
    crypto 3.0.2 (3.0.3 available)
    file 6.1.4 (7.0.0 available)
    flutter_inappwebview 6.0.0-beta.21 (6.0.0 available)
    flutter_inappwebview_internal_annotations 1.1.0 (1.1.1 available)
    http_parser 4.0.1 (4.0.2 available)
    js 0.6.5 (0.7.1 available)
    logging 1.0.2 (1.2.0 available)
    matcher 0.12.13 (0.12.16+1 available)
    material_color_utilities 0.2.0 (0.11.1 available)
    meta 1.8.0 (1.14.0 available)
    mime 1.0.2 (1.0.5 available)
    mocktail 0.3.0 (1.0.3 available)
    path 1.8.2 (1.9.0 available)
    source_span 1.9.1 (1.10.0 available)
    stack_trace 1.11.0 (1.11.1 available)
    stream_channel 2.1.1 (2.1.2 available)
    test 1.22.0 (1.25.2 available)
    test_api 0.4.16 (0.7.0 available)
    test_core 0.4.20 (0.6.0 available)
    typed_data 1.3.1 (1.3.2 available)
    vm_service 9.4.0 (14.2.0 available)
    watcher 1.0.2 (1.1.0 available)
    web_socket_channel 2.2.0 (2.4.4 available)
    webkit_inspection_protocol 1.2.0 (1.2.1 available)
    yaml 3.1.1 (3.1.2 available)
    Got dependencies!


    大佬,好像没提示问题。

    我执行 flutter run -v ,第一次出现 error 的位置,贴出来帮我再看看:

    PS C:\Users\lce\Downloads\wootz-browser-up-browser-new> flutter run -v

    [ +21 ms] executing: C:\Users\lce\AppData\Local\Android\Sdk\platform-tools\adb.exe -s emulator-5554 shell -x logcat -v time -t 1
    [ +18 ms] <- compile package:youtube_player_flutter/main.dart
    [ +84 ms] --------- beginning of main
    04-07 07:01:17.943 D/StatusBarIconController( 773): ignoring old pipeline callbacks, because the new mobile icons are enabled
    [ +10 ms] executing: C:\Users\lce\AppData\Local\Android\Sdk\platform-tools\adb.exe version
    [ +50 ms] Android Debug Bridge version 1.0.41
    Version 34.0.4-10411341
    Installed as C:\Users\lce\AppData\Local\Android\Sdk\platform-tools\adb.exe
    Running on Windows 10.0.19045
    [ +3 ms] executing: C:\Users\lce\AppData\Local\Android\Sdk\platform-tools\adb.exe start-server
    [ +51 ms] Building APK
    [ +16 ms] Running Gradle task 'assembleDebug'...
    [ +8 ms] Using gradle from C:\Users\lce\Downloads\wootz-browser-up-browser-new\android\gradlew.bat.
    [ +18 ms] executing: [C:\Users\lce\Downloads\wootz-browser-up-browser-new\android/] C:\Users\lce\Downloads\wootz-browser-up-browser-new\android\gradlew.bat --full-stacktrace --info
    -Pverbose=true -Ptarget-platform=android-x64 -Ptarget=C:\Users\lce\Downloads\wootz-browser-up-browser-new\lib\main.dart -Pbase-application-name=android.app.Application
    -Pdart-defines=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ== -Pdart-obfuscation=false -Ptrack-widget-creation=true -Ptree-shake-icons=false -Pfilesystem-scheme=org-dartlang-root
    assembleDebug
    [ +127 ms] Error: Couldn't resolve the package 'cryptowallet' in 'package:cryptowallet/screens/open_app_pin_failed.dart'.
    [ +2 ms] Error: Couldn't resolve the package 'cryptowallet' in 'package:cryptowallet/utils/app_config.dart'.
    [ ] Error: Couldn't resolve the package 'cryptowallet' in 'package:cryptowallet/utils/navigator_service.dart'.
    [ ] Error: Couldn't resolve the package 'cryptowallet' in 'package:cryptowallet/utils/rpc_urls.dart'.
    [ ] Error: Couldn't resolve the package 'cryptowallet' in 'package:cryptowallet/utils/wc_connector.dart'.
    [ ] Error: Couldn't resolve the package 'cryptowallet' in 'package:cryptowallet/models/browser_model.dart'.
    [ ] Error: Couldn't resolve the package 'cryptowallet' in 'package:cryptowallet/models/webview_model.dart'.
    [ ] Error: Couldn't resolve the package 'flutter_downloader' in 'package:flutter_downloader/flutter_downloader.dart'.
    [ ] Error: Couldn't resolve the package 'flutter_phoenix' in 'package:flutter_phoenix/flutter_phoenix.dart'.
    [ ] Error: Couldn't resolve the package 'flutter_secure_storage' in 'package:flutter_secure_storage/flutter_secure_storage.dart'.
    [ ] Error: Couldn't resolve the package 'hive' in 'package:hive/hive.dart'.
    [ ] Error: Couldn't resolve the package 'hive_flutter' in 'package:hive_flutter/hive_flutter.dart'.
    [ ] Error: Couldn't resolve the package 'multi_value_listenable_builder' in 'package:multi_value_listenable_builder/multi_value_listenable_builder.dart'.
    [ ] Error: Couldn't resolve the package 'path_provider' in 'package:path_provider/path_provider.dart'.
    [ ] Error: Couldn't resolve the package 'permission_handler' in 'package:permission_handler/permission_handler.dart'.
    [ ] Error: Couldn't resolve the package 'provider' in 'package:provider/provider.dart'.
    [ +4 ms] lib/main.dart:3:8: Error: Not found: 'package:cryptowallet/screens/open_app_pin_failed.dart'
    [ ] import 'package:cryptowallet/screens/open_app_pin_failed.dart';
    [ ] ^
    [ +3 ms] lib/main.dart:4:8: Error: Not found: 'package:cryptowallet/utils/app_config.dart'
    [ ] import 'package:cryptowallet/utils/app_config.dart';
    [ ] ^
    [ ] lib/main.dart:5:8: Error: Not found: 'package:cryptowallet/utils/navigator_service.dart'
    [ ] import 'package:cryptowallet/utils/navigator_service.dart';
    [ ] ^
    [ ] lib/main.dart:6:8: Error: Not found: 'package:cryptowallet/utils/rpc_urls.dart'
    [ +1 ms] import 'package:cryptowallet/utils/rpc_urls.dart';
    [ ] ^
    [ ] lib/main.dart:7:8: Error: Not found: 'package:cryptowallet/utils/wc_connector.dart'
    [ ] import 'package:cryptowallet/utils/wc_connector.dart';
    [ ] ^
    [ +7 ms] lib/main.dart:10:8: Error: Not found: 'package:cryptowallet/models/browser_model.dart'
    [ ] import 'package:cryptowallet/models/browser_model.dart';
    [ ] ^
    [ ] lib/main.dart:11:8: Error: Not found: 'package:cryptowallet/models/webview_model.dart'
    [ ] import 'package:cryptowallet/models/webview_model.dart';
    [ ] ^
    [ ] lib/main.dart:12:8: Error: Not found: 'package:flutter_downloader/flutter_downloader.dart'
    [ ] import 'package:flutter_downloader/flutter_downloader.dart';
    [ ] ^
    [ ] lib/main.dart:13:8: Error: Not found: 'package:flutter_phoenix/flutter_phoenix.dart'
    [ ] import 'package:flutter_phoenix/flutter_phoenix.dart';
    [ ] ^
    [ ] lib/main.dart:14:8: Error: Not found: 'package:flutter_secure_storage/flutter_secure_storage.dart'
    [ ] import 'package:flutter_secure_storage/flutter_secure_storage.dart';
    [ ] ^
    [ ] lib/main.dart:15:8: Error: Not found: 'package:hive/hive.dart'
    [ ] import 'package:hive/hive.dart';
    [ ] ^
    [ ] lib/main.dart:16:8: Error: Not found: 'package:hive_flutter/hive_flutter.dart'
    [ ] import 'package:hive_flutter/hive_flutter.dart';
    [ ] ^
    [ ] lib/main.dart:17:8: Error: Not found: 'package:multi_value_listenable_builder/multi_value_listenable_builder.dart'
    [ ] import 'package:multi_value_listenable_builder/multi_value_listenable_builder.dart';
    [ ] ^
    [ ] lib/main.dart:18:8: Error: Not found: 'package:path_provider/path_provider.dart'
    [ ] import 'package:path_provider/path_provider.dart';
    [ ] ^
    [ ] lib/main.dart:19:8: Error: Not found: 'package:permission_handler/permission_handler.dart'
    [ ] import 'package:permission_handler/permission_handler.dart';
    [ ] ^
    [ ] lib/main.dart:20:8: Error: Not found: 'package:provider/provider.dart'
    [ ] import 'package:provider/provider.dart';
    [ ] ^
    [ ] Error: Couldn't resolve the package 'flutter_localizations' in 'package:flutter_localizations/flutter_localizations.dart'.
    [ ] Error: Couldn't resolve the package 'intl' in 'package:intl/intl.dart'.
    [ ] lib/browser.dart:4:8: Error: Not found: 'package:cryptowallet/utils/wc_connector.dart'
    [ ] import 'package:cryptowallet/utils/wc_connector.dart';

    还有,编译中有这样的 warning ,我怀疑是不是和 gradle 版本有关,我目前是 6.8:
    Running Gradle task 'assembleRelease'...
    Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
    Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
    Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
    Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
    Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
    Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
    Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
    Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
    Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
    Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1439 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 17:28 · PVG 01:28 · LAX 09:28 · JFK 12:28
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.