【问题标题】:Flutter Build Failed for Android. :bitmap:externalNativeBuildDebug'Android 的 Flutter 构建失败。 :bitmap:externalNativeBuildDebug'
【发布时间】:2022-01-05 23:54:54
【问题描述】:

我尝试克隆一个 Flutter 项目并成功在 Windows 中运行,但是当我在 Linux 中运行时出现这样的错误。

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':bitmap:externalNativeBuildDebug'.
> Build command failed.
Error while executing process /home/wahyu/Android/Sdk/cmake/3.6.4111459/bin/cmake with arguments {--build /home/wahyu/.pub-cache/hosted/pub.dartlang.org/bitmap-0.1.2/android/.cxx/cmake/debug/armeabi-v7a --target bitmap}
[1/2] Building CXX object CMakeFiles/bitmap.dir/home/wahyu/.pub-cache/hosted/pub.dartlang.org/bitmap-0.1.2/ios/Classes/bitmap.cpp.o

  FAILED: /home/wahyu/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++  --target=armv7-none-linux-androideabi16 --gcc-toolchain=/home/wahyu/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/wahyu/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot  -Dbitmap_EXPORTS  -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fno-addrsig -march=armv7-a -mthumb -Wa,--noexecstack -Wformat -Werror=format-security   -O0 -fno-limit-debug-info  -fPIC -MD -MT CMakeFiles/bitmap.dir/home/wahyu/.pub-cache/hosted/pub.dartlang.org/bitmap-0.1.2/ios/Classes/bitmap.cpp.o -MF CMakeFiles/bitmap.dir/home/wahyu/.pub-cache/hosted/pub.dartlang.org/bitmap-0.1.2/ios/Classes/bitmap.cpp.o.d -o CMakeFiles/bitmap.dir/home/wahyu/.pub-cache/hosted/pub.dartlang.org/bitmap-0.1.2/ios/Classes/bitmap.cpp.o -c /home/wahyu/.pub-cache/hosted/pub.dartlang.org/bitmap-0.1.2/ios/Classes/bitmap.cpp
In file included from /home/wahyu/.pub-cache/hosted/pub.dartlang.org/bitmap-0.1.2/ios/Classes/bitmap.cpp:1:
  In file included from /snap/flutter/current/usr/include/c++/8/stdlib.h:36:
  In file included from /snap/flutter/current/usr/include/c++/8/cstdlib:41:
  In file included from /snap/flutter/current/usr/include/x86_64-linux-gnu/c++/8/bits/c++config.h:508:
  In file included from /snap/flutter/current/usr/include/x86_64-linux-gnu/c++/8/bits/os_defines.h:39:
  In file included from /snap/flutter/current/usr/include/features.h:448:
  /snap/flutter/current/usr/include/x86_64-linux-gnu/gnu/stubs.h:7:11: fatal error: 'gnu/stubs-32.h' file not found
  # include <gnu/stubs-32.h>
            ^~~~~~~~~~~~~~~~
  1 error generated.
  ninja: build stopped: subcommand failed.



* 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 15s
Exception: Gradle task assembleDebug failed with exit code 1

我尝试了很多方法,例如确保我的 Windows 和 Linux 中的 Flutter 版本相同,重新安装 NDK、CMAKE 等,但没有帮助。当我们使用 Flutter 继续一个项目时,总是这样吗?

我该怎么办?当我在 React Native 中继续一个项目时,我从来没有遇到过这样的事情。

【问题讨论】:

    标签: android react-native flutter dart flutter-dependencies


    【解决方案1】:

    解决方案是,如果您的 Flutter 没有通过 snap 安装 Flutter,则只需运行即可

    sudo apt-get install libc6-dev-i386 (Ubuntu)

    应该解决问题。

    但这不适用于通过 snap 安装的颤振。 首先用

    去除颤动
    sudo snap remove flutter
    

    并像在 Flutter 文档中一样手动重新安装 Flutter(不要使用 snap)。

    【讨论】:

      猜你喜欢
      • 2019-05-17
      • 2019-06-19
      • 2019-03-31
      • 2020-03-28
      • 2021-04-25
      • 2019-09-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多