I would like to open an AndroidStudio project from the command line on my Mac. Something like:
~ $ AndroidStudio --path ~/my_android_project
Is this possible in some way?
I would like to open an AndroidStudio project from the command line on my Mac. Something like:
~ $ AndroidStudio --path ~/my_android_project
Is this possible in some way?
Easiest way to use it from command line is to create a shortcut using Android Studio's built in tool: Menu --> Tools --> Create command line launcher.
After that, just call studio myprojectname
.
code .
android studio studio .
–
Poignant alias studio='open -b com.google.android.studio'
–
Ogdoad how about:
open -a /Applications/Android\ Studio.app /path/to/my_android_project
For Windows user, use the following command:
start "" "C:\Program Files\Android\Android Studio\bin\studio64.exe" "X:\path\to\my_android_project"
alias androidstudio="open -a /Applications/Android\ Studio.app"
so I can do e.g. androidstudio ~/my_android_project
. Thanks –
Liberalism alias android='open -a /Applications/Android\ Studio.app .'
so that I can just type android
in any Android Studio project's directory and have it open. It's the little things! ;-) –
Inigo start ""
, it's enough to do "C:\Program Files\Android\Android Studio\bin\studio64.exe" "X:\path\to\my_android_project"
. –
Jonell open -a /Applications/Android\ Studio.app
–
Hrutkay In your ~/.bash_profile
add
alias AndroidStudio="open -a /Applications/Android\ Studio.app"
Then reload your terminal and you can now do
AndroidStudio ~/my_android_project
For Mac Catalina and up, paste this line into ~/.zshrc
alias asd="open -a /Applications/Android\ Studio.app"
Save then reload it source ~/.zshrc
Now you able to open specific android project with Android Studio from terminal.
Let's try: asd /path/to/your/project
Typing the path to the android studio application binary, followed by a path to an android project directory works for me.
for example:
/Applications/Android\ Studio.app/Contents/MacOS/studio ~<username>/androidprojects/AndroidAppProjectDirectory
Use below command to open your project.
open -a Android\ Studio "Your Project Path"
Another way, which relying only on application bundle identifier (regardless application location on disk):
open -b com.google.android.studio /path/to/your/project
Tools > Create command line launcher
no longer works. This is the only command that works for me. You can make your own alias to open it in your bash/zsh profile: alias studio='open -b com.google.android.studio'
–
Ogdoad For mac users
Simply run in project directory
studio .
If you receive studio command not found
Then you need to add the following path to PATH variable as below
If you're a zsh user run this in terminal
open ~/.zshrc
Add this to the file
export PATH=$PATH:"/Applications/Android Studio.app/Contents/MacOS"
save and close file
Run this to apply previous changes in current terminal
source ~/.zshrc
Now try to run studio . again in project directory
Hope this help someone
If you are using bach
:
Terminal
and cd
to ~
like this: cd ~
.bach_profile
file with this command: open .bach_profile
.bach_profile
file:alias NAMEYOUWANT="/Applications/Android\ Studio.app"
for example alias android="/Applications/Android\ Studio.app"
If you are using zsh
:
Terminal
and cd
to ~
like this: cd ~
.zshrc
file with this command: open .zshrc
.zshrc
file:alias NAMEYOUWANT="/Applications/Android\ Studio.app"
for example alias android="/Applications/Android\ Studio.app"
You can now open a project with Android Studio using this command:open . -a NAMEYOUWANT
(with our example it would be: open . -a android
)
You can follow these steps to create any alias like opening Xcode, Visual Studio or even shortcut git commands.
This is the proper answer. There is some permission related issue. Android studio is not picking PATH.
chmod +x /Applications/Android Studio.app/Contents/bin/printenv
© 2022 - 2024 — McMap. All rights reserved.