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

[Flutter] Flutter windows app stopped working. CMake error

Discussão em 'Mobile' iniciado por Stack, Outubro 4, 2024 às 22:43.

  1. Stack

    Stack Membro Participativo

    I've been developing my Flutter app using Windows as device for debugging without any problem.

    But I recently added Firebase to the project, and I can no longer use Windows, I can only work with Android simulators.

    I didn't touch anything related to the Windows folder, this just happened after adding Firebase as I said.

    The windows/flutter/CMakeList.txt file looks like this:

    # This file controls Flutter-level build steps. It should not be edited.
    cmake_minimum_required(VERSION 3.14)

    set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")

    # Configuration provided via flutter tool.
    include(${EPHEMERAL_DIR}/generated_config.cmake)

    # TODO: Move the rest of this into files in ephemeral. See
    # https://github.com/flutter/flutter/issues/57146.
    set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")

    # Set fallback configurations for older versions of the flutter tool.
    if (NOT DEFINED FLUTTER_TARGET_PLATFORM)
    set(FLUTTER_TARGET_PLATFORM "windows-x64")
    endif()

    # === Flutter Library ===
    set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")

    # Published to parent scope for install step.
    set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
    set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
    set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
    set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)

    list(APPEND FLUTTER_LIBRARY_HEADERS
    "flutter_export.h"
    "flutter_windows.h"
    "flutter_messenger.h"
    "flutter_plugin_registrar.h"
    "flutter_texture_registrar.h"
    )
    list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
    add_library(flutter INTERFACE)
    target_include_directories(flutter INTERFACE
    "${EPHEMERAL_DIR}"
    )
    target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
    add_dependencies(flutter flutter_assemble)

    # === Wrapper ===
    list(APPEND CPP_WRAPPER_SOURCES_CORE
    "core_implementations.cc"
    "standard_codec.cc"
    )
    list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
    list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
    "plugin_registrar.cc"
    )
    list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
    list(APPEND CPP_WRAPPER_SOURCES_APP
    "flutter_engine.cc"
    "flutter_view_controller.cc"
    )
    list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")

    # Wrapper sources needed for a plugin.
    add_library(flutter_wrapper_plugin STATIC
    ${CPP_WRAPPER_SOURCES_CORE}
    ${CPP_WRAPPER_SOURCES_PLUGIN}
    )
    apply_standard_settings(flutter_wrapper_plugin)
    set_target_properties(flutter_wrapper_plugin PROPERTIES
    POSITION_INDEPENDENT_CODE ON)
    set_target_properties(flutter_wrapper_plugin PROPERTIES
    CXX_VISIBILITY_PRESET hidden)
    target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
    target_include_directories(flutter_wrapper_plugin PUBLIC
    "${WRAPPER_ROOT}/include"
    )
    add_dependencies(flutter_wrapper_plugin flutter_assemble)

    # Wrapper sources needed for the runner.
    add_library(flutter_wrapper_app STATIC
    ${CPP_WRAPPER_SOURCES_CORE}
    ${CPP_WRAPPER_SOURCES_APP}
    )
    apply_standard_settings(flutter_wrapper_app)
    target_link_libraries(flutter_wrapper_app PUBLIC flutter)
    target_include_directories(flutter_wrapper_app PUBLIC
    "${WRAPPER_ROOT}/include"
    )
    add_dependencies(flutter_wrapper_app flutter_assemble)

    # === Flutter tool backend ===
    # _phony_ is a non-existent file to force this command to run every time,
    # since currently there's no way to get a full input/output list from the
    # flutter tool.
    set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
    set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
    add_custom_command(
    OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
    ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
    ${CPP_WRAPPER_SOURCES_APP}
    ${PHONY_OUTPUT}
    COMMAND ${CMAKE_COMMAND} -E env
    ${FLUTTER_TOOL_ENVIRONMENT}
    "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
    ${FLUTTER_TARGET_PLATFORM} $<CONFIG>
    VERBATIM
    )
    add_custom_target(flutter_assemble DEPENDS
    "${FLUTTER_LIBRARY}"
    ${FLUTTER_LIBRARY_HEADERS}
    ${CPP_WRAPPER_SOURCES_CORE}
    ${CPP_WRAPPER_SOURCES_PLUGIN}
    ${CPP_WRAPPER_SOURCES_APP}
    )



    i get these CMake Warnings :


    CMake Warning (dev) at CMakeLists.txt:22 (set):Cannot set "FLUTTER_LIBRARY": current scope has no parent.


    CMake Warning (dev) at CMakeLists.txt:23 (set):Cannot set "FLUTTER_ICU_DATA_FILE": current scope has no parent.


    CMake Warning (dev) at CMakeLists.txt:24 (set):Cannot set "PROJECT_BUILD_DIR": current scope has no parent.


    CMake Warning (dev) at CMakeLists.txt:25 (set):Cannot set "AOT_LIBRARY": current scope has no parent.

    and this CMakeError:


    CMake Error at CMakeLists.txt:63 (apply_standard_settings):Unknown CMake command "apply_standard_settings".

    When I open the generated_plugin_registrant.cc and generated_plugins_registrant.h, some errors appear too at the includes.

    generated_plugin_registrant.cc :


    cannot open source file "cloud_firestore/cloud_firestore_plugin_c_api.h"


    cannot open source file "file_selector_windows/file_selector_windows.h"


    cannot open source file "firebase_auth/firebase_auth_plugin_c_api.h"


    cannot open source file "firebase_core/firebase_core_plugin_c_api.h"


    cannot open source file "firebase_storage/firebase_storage_plugin_c_api.h"


    #include errors detected based on information provided by the configurationProvider setting. Squiggles are disabled for this translation unit (C:\Users\Antonio\Desktop\TFG\code\apiary\windows\flutter\generated_plugin_registrant.cc).


    cannot open source file "flutter_linux/flutter_linux.h" (dependency of "C:\Users\Antonio.vscode\extensions\ms-vscode.cpptools-1.21.6-win32-x64\bin\objectbox_flutter_libs\objectbox_flutter_libs_plugin.h")

    generated_plugins_registrant.h :


    #include errors detected based on information provided by the configurationProvider setting. Squiggles are disabled for this translation unit (C:\Users\Antonio\Desktop\TFG\code\apiary\windows\flutter\generated_plugin_registrant.cc).

    Continue reading...

Compartilhe esta Página