0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

React NativeのビルドにAndroid Studioに同梱されているJavaを使う

Last updated at Posted at 2020-02-02

React NativeでAndroid向けにビルドする場合、環境にJavaがインストールされている必要がある。

メジャーなのはOracleの配布しているJava。しかしAndroid StudioにはそれでなくOpen JDKが同梱されている。

Android Studioのと合わせた方がトラブルが生じにくいだろうし、またOracle Javaのライセンス変更1を気にする必要もなくなるため、Android Studioに同梱されているJavaをReact Nativeのビルドに使う。

環境

  • macOS Mohave 10.14.6
  • react-native: 0.61.5

手順

.bash_profileに下記のように記述する。

export PATH=$PATH:/Applications/"Android Studio.app"/Contents/jre/jdk/Contents/Home/bin
export JAVA_HOME=/Applications/"Android Studio.app"/Contents/jre/jdk/Contents/Home

参考

Android Studioで使っているJDKをターミナルでも使う
https://qiita.com/tsumuchan/items/43a55789f1cf213611cc

  1. 「Oracle Java」のライセンスが変更 ~無償利用は個人での開発・テスト・デモ目的のみに

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?