Android 的 Flutter 构建失败。:位图:externalNativeBuildDebug'



我试图克隆一个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中继续一个项目时,我从未面临过这样的事情。

解决方案是,如果您的flutter没有通过snap安装flutter,那么只需运行

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

应该解决这个问题。

但是,这不适用于通过卡扣安装的颤振。首先用消除颤振

sudo snap remove flutter

并像flutter文档中那样手动重新安装flutter(不要使用snap(。

最新更新