💭

Xcode、Android Studio、flutter.xxx などのバージョン確認チートシート

2025/02/28に公開

XcodeやAndroid Studioなどの開発環境のバージョンをCLIでサクッと確認する自分メモです。
設計書にバージョンを書く際などに利用できるかと思います。

※Macでの動作確認用

Xcode

Xcodeのバージョン

確認コマンド
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -version
実行結果
Xcode 16.2
Build version 16C5032a

Xcodeに付属しているSwiftのバージョン

確認コマンド
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -version
実行結果
swift-driver version: 1.115.1 Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)
Target: arm64-apple-macosx14.0

XcodeのSDKのバージョン

確認コマンド
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -showsdks
実行結果
DriverKit SDKs:
	DriverKit 24.2                	-sdk driverkit24.2

iOS SDKs:
	iOS 18.2                      	-sdk iphoneos18.2

iOS Simulator SDKs:
	Simulator - iOS 18.2          	-sdk iphonesimulator18.2

macOS SDKs:
	macOS 15.2                    	-sdk macosx15.2
	macOS 15.2                    	-sdk macosx15.2

tvOS SDKs:
	tvOS 18.2                     	-sdk appletvos18.2

tvOS Simulator SDKs:
	Simulator - tvOS 18.2         	-sdk appletvsimulator18.2

visionOS SDKs:
	visionOS 2.2                  	-sdk xros2.2

visionOS Simulator SDKs:
	Simulator - visionOS 2.2      	-sdk xrsimulator2.2

watchOS SDKs:
	watchOS 11.2                  	-sdk watchos11.2

watchOS Simulator SDKs:
	Simulator - watchOS 11.2      	-sdk watchsimulator11.2

Android Studio

Android Studioのバージョン

確認コマンド
/Applications/Android\ Studio.app/Contents/MacOS/studio --version
実行結果
Android Studio Ladybug Feature Drop | 2024.2.2
Build #AI-242.23726.103.2422.12816248

Android Studioが内包しているJDKのバージョン

確認コマンド
/Applications/Android\ Studio.app/Contents/jbr/Contents/Home/bin/java --version
実行結果
openjdk 21.0.4 2024-07-16
OpenJDK Runtime Environment (build 21.0.4+-12422083-b607.1)
OpenJDK 64-Bit Server VM (build 21.0.4+-12422083-b607.1, mixed mode)

Flutterアプリ android/app/build.gradle

android/app/build.gradle抜粋
android {
    compileSdk = flutter.compileSdkVersion
    ndkVersion = flutter.ndkVersion
}

flutter.xxxは、<Flutter SDK install folder>/packages/flutter_tools/gradle/src/main/groovy/flutter.groovyファイルに定義されているそうです。
(Flutter 3.13以降)

下記サイト参考
https://blog.mori-soft.com/entry/2023/05/20/100000

flutterをパッケージで管理している人は下記の通り
※今回は、3.29.0を利用していますが、利用しているバージョンを指定するようにしてください。

FVM

確認コマンド
cat ~/fvm/versions/3.29.0/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy

asdf

確認コマンド
cat ~/.asdf/installs/flutter/3.29.0-stable/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy
実行結果(一部抜粋)
class FlutterExtension {

    /** Sets the compileSdkVersion used by default in Flutter app projects. */
    public final int compileSdkVersion = 35

    /** Sets the minSdkVersion used by default in Flutter app projects. */
    public  final int minSdkVersion = 21

    /**
     * Sets the targetSdkVersion used by default in Flutter app projects.
     * targetSdkVersion should always be the latest available stable version.
     *
     * See https://developer.android.com/guide/topics/manifest/uses-sdk-element.
     */
    public final int targetSdkVersion = 35

    /**
     * Sets the ndkVersion used by default in Flutter app projects.
     * Chosen as default version of the AGP version below as found in
     * https://developer.android.com/studio/projects/install-ndk#default-ndk-per-agp.
     */
    public final String ndkVersion = "26.3.11579264"

各値は下記のようになります。

  • flutter.compileSdkVersion:35
  • flutter.minSdkVersion:21
  • flutter.targetSdkVersion:35
  • flutter.ndkVersion:"26.3.11579264"

おまけ

特定のキーワードでgrepしてしまうと速いかも。。。

確認コマンド
grep "ndkVersion" ~/fvm/versions/3.29.0/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy
実行結果
     * Sets the ndkVersion used by default in Flutter app projects.
    public final String ndkVersion = "26.3.11579264"
    /** Prints error message and fix for any plugin compileSdkVersion or ndkVersion that are higher than the project. */
            String ndkVersionIfUnspecified = "21.1.6352462" /* The default for AGP 4.1.0 used in old templates. */
            String projectNdkVersion = project.android.ndkVersion ?: ndkVersionIfUnspecified
                    String pluginNdkVersion = pluginProject.android.ndkVersion ?: ndkVersionIfUnspecified
                                        ndkVersion = \"${maxPluginNdkVersion}\"

Discussion