Search code examples
react-nativephpstormandroid-settings

Setting ANDROID_HOME variable globally on PhpStorm / WebStorm on Linux


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


Solution

  • 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>