0

PhpStorm / Webstorm on Linux didn't mentioned the System-ENV Variables. So even if you have export ANDROID_HOME in your .bashrc or .bash_profiles, this Variable is not usable in PhpStorm.

Currently I need it to run react-native packager:

"start": "node node_modules/react-native/local-cli/cli.js run-android"

FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring project ':app'.

    SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable

So what is the easiest way to fix this globally and permanent for the Project

2 Answers 2

2

There are two ways.

First (but not best) is to set the Enviroment-Variable for each Script-Entry in the Edit Run/Debug Configuration settings:

enter image description here

Better way is to set it globally per Project. To do this, do the following steps:

  1. Open your Project
  2. Browse to the /android Directory in your Project
  3. Create a file named: local.properties
  4. Insert sdk.dir=<pathToYourAndroidSDKgoesHere>
Sign up to request clarification or add additional context in comments.

Comments

1

When being launched from desktop/System menu, PhpStorm only sees environment variables configured in ~/.profile (login shell), but not in interactive shell configuration files (like ~/.bashhrc). Possible workarounds:

  • Workaround 1: make required variables available in a login shell (i.e. for bash, move them from .bashrc to .bash_profile).
  • Workaround 2: run IDE from a terminal, via bin/phpstorm.sh
  • Workaround 3: edit the desktop launcher and set command to /bin/bash -l -i -c "/path/to/phpstorm.sh"

see also https://youtrack.jetbrains.com/issue/IDEABKL-7589

And one more thing to check: make sure that Include parent environment variables checkbox is ticked in your Run configuration, Environment variables dialog

1 Comment

Thats work not for me, if I start phpstorm with jetbrains-toolbox.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.