LoginSignup
1

More than 5 years have passed since last update.

Android Studioがapkを作る時に使っているJavaのPathのメモ

Posted at

windows版android studioが使っているjavaのpathが、どこからapkを作るかによって違うということに気づいたのでメモ

Javaのpathの設定方法

OSの環境変数

システムの環境変数にJAVA_HOMEを作ってPathに%JAVA_HOME%\binを追加するという一般的なアレ。

android studio のJDK location

android studio の画面上部のタブの一番左の、File>Other Settings>Default Project Structure から設定するJDK location

どちらのPathのJavaが使われるか

Build>Make ProjectやBuild>Build APK(s)やInstantラン時

android studio の画面上部のタブの、Build>Make ProjectやBuild>Build APK(s)や、その下の段にあるinstantラン(▶)やデバッグからapkを作るときは、android studio のJDK locationが使用されている。

Terminalからgradlew assemble〇〇などした時

android studio の画面下部のタブの、Terminalから、gradlew assembleDebugなど、コマンドラインからAPKを作成したときはOSの環境変数で設定したPathのJavaが使用されている。

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
1