1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Flutter】Target dart_build failed: Error: Android NDK Clang could not be found.

Last updated at Posted at 2025-12-18

はじめに

Androidでデバッグビルドしようとした際に発生したビルドエラーとその解決方法を備忘録としてまとめています。
この記事を参考にする際は、自己責任でお願いいたします。

環境

macOS Sequoia 15.6.1
Flutter 3.38.3

発生したエラー

AndroidエミュレータでデバッグビルドしたらAndroid NDK Clang could not be found.というエラーが発生。

Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
Target dart_build failed: Error: Android NDK Clang could not be found.
2

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Users/{userName}/fvm/versions/3.38.3/bin/flutter'' finished with non-zero exit value 1

* 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 3m 52s
Error: Gradle task assembleDebug failed with exit code 1

エラーの詳細

NDKが壊れてしまい、Clangが参照できない状態になっていることが原因のようです。
local.propertiesプロジェクトレベルbuild.gradleアプリレベルbuild.gradleでNDKが指定されていて、そのNDK自体は正常だったとしても、インストールされている別バージョンのNDKの中に壊れたものがあるとエラーになることがあります。

解決方法

以下の順番で作業して解決しました。

  1. インストールされているすべてのNDKバージョンを確認
  2. NDKを全部消す
  3. NDKを再インストール

1. インストールされているすべてのNDKバージョンを確認

NDKは~/Library/Android/sdk/ndk/にあります。
あとで同じNDKを再インストールしたい場合は、以下のコマンドでインストールされているNDKを確認して、メモしておいてください。

$ ls ~/Library/Android/sdk/ndk/ 

2. NDKを全部消す

NDKを全部消します。

$ rm -rf ~/Library/Android/sdk/ndk/*

3. NDKを再インストール

Android StudioのSDK Manager > Languages & Frameworks > Android SDKSDK ToolsタブのNDKセクションで、インストールしたいNDKバージョンにチェックを入れて右下のApplyを押してインストールします。
消したNDKと同じバージョンを再インストールしたい方は、先ほどメモしたNDKのバージョンを選択してインストールしてください。

私の環境では、これでビルドが通るようになりました。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?