TL;DR
Project root eas.json
=> build
=> production
=> "env": { "ANDROID_SDK_ROOT": "/path/to/AndroidSDK" }
Step 1: find path to your Android SDK
The problem in general is that the EAS build is missing path to Android SDK, so first you need to find the correct path,
Android SDK does not have to be in the default path
but if you have it in one of the following, you can take it and jump to step 2 (replace YourUserName
with your username):
Windows: C:\\Users\\YourUserName\\AppData\\Local\\Android\\sdk
Mac: /Users/YourUserName/Library/Android/sdk
Linux: /home/YourUserName/Android/Sdk
On some systems, the paths may be case-sensitive => copy them as-they-are from system
I personally for example have SDK on a bigger HDD elswhere. Don't know the path but still have Android Studio? => try looking for "Android SDK" in "System Settings" in settings/configuration - Configure => Settings => Appearance & Behavior (or maybe you have it under Preferences). Don't have Android Studio anymore/path there is not valid? => you're left with brute force searching for "android*" in folders like "tools", "build-tools", "emulator", but you may be better off with just installing the SDK into a new
location :-)
Step 2: configure in eas.json
Depending on your target build (I assume production
) you want to define the ANDROID_SDK_ROOT
environmental variable for the target build under env
JSON key in eas.json
. The eas.json
should be in your react native project root folder - for example on the same level as src
or .expo
folders usually are.
Example eas.json
on Linux/Ubuntu:
{
"cli": {
"version": ">= 0.49.0"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal"
},
"production": {
"env": {
"ANDROID_SDK_ROOT": "/home/YourUserName/Android/Sdk"
}
}
},
"submit": {
"production": {}
}
}
Change/keep cli
version according to your project.