1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] Flutter project broke specifically through vscode's terminal. Any idea how to fix...

Discussão em 'Mobile' iniciado por Stack, Novembro 1, 2024 às 20:52.

  1. Stack

    Stack Membro Participativo

    I have a flutter project that was working for four days. Last night I updated the code and it broke. I reverted the changes but it stayed broken. I always used to run it in vscode's powershell. I discovered after a lot of trial and error the code compiles on every other terminal (powershell, command prompt, powershell on android studio, etc...). According to vscode, there is an error within one of the cmake files (line 21, its commented as such in the example so you can ctrl + f). This error is not tagged as an error in android studio. Does anyone have any idea about what could be happening specifically in regards to vscode and how to fix it? I have git on path (git runs on every terminal in my computer, vscode's powershell included)

    Thank you in advance.

    Operating System: windows 10

    ./windows/runner/CmakeLists.txt

    cmake_minimum_required(VERSION 3.14)
    project(runner LANGUAGES CXX)

    # Define the application target. To change its name, change BINARY_NAME in the
    # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
    # work.
    #
    # Any new source files that you add to the application should be added here.
    add_executable(${BINARY_NAME} WIN32
    "flutter_window.cpp"
    "main.cpp"
    "utils.cpp"
    "win32_window.cpp"
    "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
    "Runner.rc"
    "runner.exe.manifest"
    )

    # Apply the standard set of build settings. This can be removed for applications
    # that need different build settings.
    apply_standard_settings(${BINARY_NAME}) #line 21, broken according to only vscode

    # Add preprocessor definitions for the build version.
    target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
    target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
    target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
    target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
    target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")

    # Disable Windows macros that collide with C++ standard library functions.
    target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")

    # Add dependency libraries and include directories. Add any application-specific
    # dependencies here.
    target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
    target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib")
    target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")

    # Run the Flutter tool portions of the build. This must not be removed.
    add_dependencies(${BINARY_NAME} flutter_assemble)



    vs code powershell:

    PS D:\programmingfiles\Project\Project> flutter run -d windows
    Launching lib\main.dart on Windows in debug mode...
    CUSTOMBUILD : error : Unable to find git in your PATH. [D:\programmingfiles\Project\Project\build\windows\x64\flutter\flutter_assemble.vcxproj]
    D:\visual studio\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build for 'D:\programmingfiles\Project\Project\build\windows\x64\CMakeFiles\ab1312b390e9d01057e733057db02a7c\flutter_windows.dll.rule;D:\programmingfiles\Project\Project\build\windows\x64\CMakeFiles\dcf1585d978e9dd5b1ec90bc6f6e410c\flutter_assemble.rule' exited with code 1. [D:\programmingfiles\Project\Project\build\windows\x64\flutter\flutter_assemble.vcxproj]
    Building Windows application... 881ms
    Error: Build process failed.


    powershell:

    PS D:\programmingfiles\Project\Project> flutter run -d windows
    Launching lib\main.dart on Windows in debug mode...
    Building Windows application... 5.3s
    ✓ Built build\windows\x64\runner\Debug\project.exe
    Syncing files to device Windows... 76ms

    Flutter run key commands.
    r Hot reload.
    R Hot restart.
    h List all available interactive commands.
    d Detach (terminate "flutter run" but leave application running).
    c Clear the screen
    q Quit (terminate the application on the device).

    A Dart VM Service on Windows is available at: http://127.0.0.1:57134/2XZ8tADElZo=/
    The Flutter DevTools debugger and profiler on Windows is available at:
    http://127.0.0.1:9102?uri=http://127.0.0.1:57134/2XZ8tADElZo=/

    Continue reading...

Compartilhe esta Página