question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: CAPACITOR_ANDROID_STUDIO_PATH does not work with JetBrains toolbox managed shell scripts.

See original GitHub issue

Bug Report

Capacitor Version

Latest Dependencies:

  @capacitor/cli: 3.3.2
  @capacitor/core: 3.3.2
  @capacitor/android: 3.3.2
  @capacitor/ios: 3.3.2

Installed Dependencies:

  @capacitor/cli: 3.3.2
  @capacitor/android: 3.3.2
  @capacitor/core: 3.3.2
  @capacitor/ios: 3.3.2

Platform(s)

MacOs

Current Behavior

JetBrains ToolBox has integrated shell scripts that point to the latest Android studio version installed. (see here). This is done because each release incorporates the build ID on the path, so a hard coded path will always break after a version update.

Setting the path of the generated studio.sh script into CAPACITOR_ANDROID_STUDIO_PATH fails with:

[error] Unable to launch Android Studio. Is it installed?
        Attempted to open Android Studio at: /usr/local/bin/studio.sh
        You can configure this with the CAPACITOR_ANDROID_STUDIO_PATH environment variable.

Expected Behavior

We could be able to give this script to open capacitor projects.

Code Reproduction

Other Technical Details

The generated script looks like this:

#!/bin/bash
#Generated by JetBrains Toolbox 1.22.10740 at 2021-11-18T10:21:56.087264

declare -a ideargs=()
declare -- wait=""

for o in "$@"; do
  if [[ "$o" = "--wait" || "$o" = "-w" ]]; then
    wait="-W"
    o="--wait"
  fi
  if [[ "$o" =~ " " ]]; then
    ideargs+=("\"$o\"")
  else
    ideargs+=("$o")
  fi
done

open -na "/Users/my-user/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7784292/Android Studio.app/Contents/MacOS/studio" $wait --args "${ideargs[@]}"%      

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:9
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
saschpecommented, Jan 6, 2022

You can put this in your .zshrc or .bashrc as a workaround:

androidStudioToolboxBase="${HOME}/Library/Application\ Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0"
androidStudioToolboxVersion=$(ls ${androidStudioToolboxBase})
export CAPACITOR_ANDROID_STUDIO_PATH=${androidStudioToolboxBase}/${androidStudioToolboxVersion}/Android\ Studio.app/

It would be better if that location is checked as well by default on Apple hardware.

2reactions
butaminascommented, Jan 23, 2022

You can put this in your .zshrc or .bashrc as a workaround:

androidStudioToolboxBase="${HOME}/Library/Application\ Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0"
androidStudioToolboxVersion=$(ls ${androidStudioToolboxBase})
export CAPACITOR_ANDROID_STUDIO_PATH=${androidStudioToolboxBase}/${androidStudioToolboxVersion}/Android\ Studio.app/

It would be better if that location is checked as well by default on Apple hardware.

I use MacOS and I had to remove quotes from the first line for it to work. Thanks for sharing!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generate shell scripts does not work : TBX-6792
I have enabled "Generate shell scripts" in Jetbrains toolbox but the "idea" script is not generated. script name is set to "idea" and...
Read more >
JetBrains Toolbox does not generate shell scripts : TBX-4495
Hi, what it says in the title. OS: Ubuntu 18.04 LTS (Elementary OS) Toolbox install location: ~/.local/share/JetBrains/Toolbox. Steps to reproduce:.
Read more >
Jetbrains Toolbox not generating Shell Scripts.
Then went to settings and enabled "generate shell scripts". The location is set to usr/local/bin. Still I'm not able to run the PyCharm...
Read more >
Toolbox command-line script is unable to start "diff" tool on ...
These arguments are not opened or inter- preted by the open tool. Plain text. but the shell script generated by Jetbrains Toolbox is...
Read more >
toolbox app does not install shell scripts : TBX-3371 - YouTrack
What steps will reproduce the issue? enable "generate shell scripts" in toolbox settings; set scripts directory to /Users/christoph/bin; uninstall IDEA and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found