1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【環境構築】Swift SDK For Androidのインストール

Last updated at Posted at 2025-10-30

概要

  • Mac環境にてSwift SDK For Androidをダウンロードする

実行環境

  • 実行日:2025年10月30日
  • 機種:MacBookAir M1, 2020
  • OS:Tahoe 26.0.1

手順

1. swiftly / swift-x.y.z.pkgのインストール

2.のコマンドが使える場合はこの手順を省略可能です

$ swiftly install main-snapshot-2025-10-16
  • swiftlyのコマンドでswift-x.y.z.pkgが見つからないと言われた場合の対応法は下記の記事を参照


2. 使用するsnapshotのダウンロード

2-1. snapshotのインストール

$ swiftly install main-snapshot-2025-10-16

$ swift use main-snapshot-2025-10-16

$ swiftly run swift --version

途中このような選択肢があるのでY/nを選択

For your convenience, swiftly will also attempt to modify your shell's profile file to make
installed items available in your environment upon login. This can be suppressed with the
'--no-modify-profile' option.

Proceed? (Y/n): 

2-2. 正常にインストールされたか確認する

  • $ swiftly run swift --versionを叩いた際に、下記のような出力が成されていれば正常にインストールが終了
$ swiftly run swift --version
Apple Swift version 6.2 (swift-6.2-RELEASE)
Target: arm64-apple-macosx26.0
Build config: +assertions

3. Android SDKのインストール

3-1. URLを指定してSDKをインストールする

swift sdk install https://download.swift.org/development/android-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-10-16-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-16-a_android-0.1.artifactbundle.tar.gz --checksum 451844c232cf1fa02c52431084ed3dc27a42d103635c6fa71bae8d66adba2500

3-2. 正常にインストールされたか確認する

$ swiftly run swift sdk list

swift-DEVELOPMENT-SNAPSHOT-2025-10-16-a-android-0.1

4. Android NDKのインストール

4-1. android-ndkディレクトリに移動する

$ mkdir ~/android-ndk; cd ~/android-ndk;

4-2. Android NDKのzipフォルダをインストール

android-ndk $ curl -fSLO https://dl.google.com/android/repository/android-ndk-r27d-$(uname -s).zip

4-3. インストールした.zipフォルダを解凍する

android-ndk $ unzip -q android-ndk-r27d-*.zip

4-4. 環境変数を設定する

android-ndk $ export ANDROID_NDK_HOME=$PWD/android-ndk-r27d

5. Android SDKのセットアップを行う

5-1. .swiftpmの格納されている場所を探して移動

$ cd ~/Library/org.swift.swiftpm || cd ~/.swiftpm

5-2.Android SDKを実行する

org.swift.swiftpm $ ./swift-sdks/swift-DEVELOPMENT-SNAPSHOT-2025-10-16-a-android-0.1.artifactbundle/swift-android/scripts/setup-android-sdk.sh

下記のような出力になれば成功

setup-android-sdk.sh: success: ndk-sysroot linked to Android NDK at /Users/{省略}/android-ndk/android-ndk-r27d/toolchains/llvm/prebuilt

環境構築はこれにて終了です。
お疲れ様でした。

Next Step

  • Hello, Worldを出力する

参考

1
2
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
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?