SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable

Any idea how to get out of this error please
I ran react-native link after react-native run-android
Ps : I use expo app then I eject my project

Unable to detect AGP versions for included builds. All projects in the build should use the same AGP version. Class name for the included build object

BUILD FAILED in 1m 15s

error Failed to install the app. Make sure you have the Android development environment set up: Setting up the development environment · React Native.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
(node:15708) [DEP0148] DeprecationWarning: Use of deprecated folder mapping “./” in the “exports” field module resolution of the package at C:\Users..\plant-app\node_modules@expo\devcert\node_modules\tslib\package.json.
Update this package.json to use a subpath pattern like “./*”.
(Use node --trace-deprecation ... to show where the warning was created)
Note: C:\Users.…\plant-app\node_modules\react-native-gradle-plugin\src\main\java\com\facebook\react\codegen\generator\ uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac’.

SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project’s local properties file at ‘C:\Users.…\plant-app\android\’.

Hey @keltouma,

Seems like when you are building it locally, the react native project doesn’t seem to find the path to the Android SDK. Can you try steps mentioned in the answer from this StackOverflow post: android - Expo build EAS - local - SDK location not found - Stack Overflow?

Let me know if that works or not.

1 Like

Hey, @amanhimself, has something changed? I thought the env section of eas.json was only relevant to the build servers and did not apply when building locally.

But when building locally you can of course set the environment variable as normal instead of in eas.json.

1 Like

I don’t think anything changed. I’ll confirm that with the team just in case.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.