title: React-Native run-android command cannot find Android Studio and SDK
body: <p>I am building a React-Native project on Mac OS. My Mac is Mac Mini which is using the new Apple M1 chip. I can build and run my project on iOS simulator using &quot;react-native run-android&quot; command. But when I run &quot;react-native run-android&quot; command, it is not working.</p>
  <p>I downloaded and installed the Java JDK. When I type in &quot;java -version&quot; in the terminal, I can see the following output.</p>
  <pre><code>openjdk version &quot;17&quot; 2021-09-14 LTS
  OpenJDK Runtime Environment Zulu17.28+13-CA (build 17+35-LTS)
  OpenJDK 64-Bit Server VM Zulu17.28+13-CA (build 17+35-LTS, mixed mode, sharing)
  </code></pre>
  <p>Then I downloaded and installed the latest version of Android Studio. It is installed and Android SDK is located in the following path.</p>
  <pre><code>/Users/waihein/Library/Android/sdk
  </code></pre>
  <p>I have the following content in the ~/.hash_profile file.</p>
  <pre><code>export PATH=&quot;/usr/local/bin:$PATH&quot;
  export ANDROID_HOME=/Users/waihein/Library/Android/sdk
  export PATH=$PATH:$ANDROID_HOME/emulator
  export PATH=$PATH:$ANDROID_HOME/tools 
  export PATH=$PATH:$ANDROID_HOME/tools/bin 
  export PATH=$PATH:/Users/waihein/Library/Android/sdk/platform-tools/
  </code></pre>
  <p>Within my react-native project folder, when I run &quot;react-native run-android&quot;, I got the following output.</p>
  <pre><code>* What went wrong:
  Unable to start the daemon process.
  This problem might be caused by incorrect configuration of the daemon.
  For example, an unrecognized jvm option is used.
  Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/6.8/userguide/gradle_daemon.html
  Process command line: /Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home/bin/java -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country=GB -Duser.language=en -Duser.variant -cp /Users/waihein/.gradle/wrapper/dists/gradle-6.8-all/9emh0d32e025cam7aasxcw002/gradle-6.8/lib/gradle-launcher-6.8.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 6.8
  Please read the following process output to find out more:
  -----------------------
  Unrecognized VM option 'MaxPermSize=512m'
  Error: Could not create the Java Virtual Machine.
  Error: A fatal exception has occurred. Program will exit.
  
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  
  * Get more help at https://help.gradle.org
  
  error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
  Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
  </code></pre>
  <p>I tried using &quot;sudo react-native run-android&quot; too, I got the same error.</p>
  <p>When I run &quot;react-native doctor&quot; command, I got the following output.</p>
  <p><a href="https://i.stack.imgur.com/lR8Ku.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lR8Ku.png" alt="enter image description here" /></a></p>
  <p>But I installed the Android studio correctly. What is wrong with my configuration or installation and how can I fix it?</p>