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

【React Native × EAS Build】Androidの targetSdkVersion を明示的に指定する方法

Posted at

皆さん、こんにちは。

今回は【React Native × EAS Build】Androidの targetSdkVersionを明示的に指定する方法について紹介させていただきます。

React Native プロジェクトで EAS Build を使って Android アプリをビルドする際、targetSdkVersion を明示的に指定する方法をまとめました。

最近では Google Play の要件として targetSdkVersion の引き上げが求められており、これを設定しないとビルドエラーやストア公開の拒否といった問題につながる可能性があります。

🧩 前提条件

  • React Native プロジェクト
  • eas build を利用している(Managed または Bare workflow)
  • Expo SDK 45 以上推奨
  • Android アプリのビルドを行う予定

🎯 目的

eas build -p android実行時に、AndroidtargetSdkVersionを指定し、Google Play の最新要件に対応する。

eas.json の確認

eas.json
{
  "build": {
    "production": {
      "android": {
        "buildType": "apk"
      }
    }
  }
}

ここでは production プロファイルを使用する前提で進めます。

expo-build-properties プラグインを導入

targetSdkVersionを設定するには、expo-build-propertiesプラグインを使います。

npx expo install expo-build-properties

app.jsonまたはapp.config.jsに設定を追加

app.json
{
  "expo": {
    "plugins": [
      [
        "expo-build-properties",
        {
          "android": {
            "targetSdkVersion": 34
          }
        }
      ]
    ]
  }
}
  • targetSdkVersion は 2025年時点では 33以上 が Google Play の要件となっています。
  • 必要に応じて compileSdkVersion や minSdkVersion も一緒に設定できます。

EAS Build の実行

eas build -p android --profile production

ビルドログ中にtargetSdkVersion 34などが表示されているか確認しましょう。

🛠️ 補足:他のオプション例(app.config.js の場合)

export default {
  expo: {
    plugins: [
      [
        "expo-build-properties",
        {
          android: {
            compileSdkVersion: 34,
            targetSdkVersion: 34,
            minSdkVersion: 24
          }
        }
      ]
    ]
  }
};

ビルド後の確認方法

ビルドされたAPKまたはAABAndroid StudioAPK Analyzerで開き、targetSdkVersion の値を確認できます。

🔚 まとめ

Google Play のポリシーにより、target SDK の要件は年々厳しくなっています。

React Native + EAS Build 環境では、expo-build-properties プラグインを使えば簡単に指定できるので、ぜひ設定しておきましょう!

今日は以上です。

ありがとうございました。
よろしくお願いいたします。

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