Skip to content

android_libcpp_shared` 0.2.0 fails on NDK 28 for arm64-v8a #5

@chillbrodev

Description

@chillbrodev

android_libcpp_shared 0.2.0 fails on NDK 28 for arm64-v8a

Package: package:android_libcpp_shared 0.2.0
Repo: dart-lang/native
Flutter: 3.44.2
NDK: 28.2.13676358
Host: macOS with Apple Silicon M1 Pro
Target ABI: arm64-v8a (Pixel 6a)

Error:

Hook.build hook of package:android_libcpp_shared has invalid output
- Code asset "package:android_libcpp_shared/libc++_shared.so" file
  (/Users/.../ndk/28.2.13676358/toolchains/llvm/prebuilt/darwin-x86_64//sysroot/usr/lib/aarch64-linux-android/libc++_shared.so)
  does not exist as a file.

Root cause:

NDK 28 changed the layout for arm64. There are two issues:

1. Wrong path — missing API-level subdirectory.
The package looks at:

sysroot/usr/lib/aarch64-linux-android/libc++_shared.so

But in NDK 28 the file lives at:

sysroot/usr/lib/aarch64-linux-android/24/libc++.so

2. Wrong filename.
For arm64 in NDK 28 the library is named libc++.so, not libc++_shared.so.

Verification:

# Top-level aarch64 directory — no libc++_shared.so
ls $NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/
# libc++_static.a  libc++abi.a  libc++experimental.a  libc.a  ...
# No libc++_shared.so

# API-level subdirectory — libc++.so present under a different name
ls $NDK_HOME/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/24/
# libc++.so  libc.so  libm.so  libdl.so  ...

# Other ABIs still have libc++_shared.so at the top level (not affected)
find $NDK_HOME -name "libc++_shared.so"
# arm-linux-androideabi, x86_64-linux-android, i686-linux-android, riscv64-linux-android
# Missing: aarch64-linux-android

Additional behaviour:
The build succeeds on the first run because hook output is cached in .dart_tool/hooks_runner/. Subsequent builds (or after flutter clean) fail immediately because the cached file path is validated and the file does not exist. This makes the bug appear intermittent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions