I have a ionic angular application. When I run 'ionic capacitor build android' from WSL
I get the following errors:
[INFO] Ready for use in your Native IDE!
To continue, build your project using Android Studio!
> capacitor open android
[capacitor] [error] Unable to launch Android Studio. Is it installed?
[capacitor] Attempted to open Android Studio at: /usr/local/android-studio/bin/studio.sh
[capacitor] You can configure this with the CAPACITOR_ANDROID_STUDIO_PATH environment variable.
I have android studio installed and additionally have set the system env variable for CAPACITOR_ANDROID_STUDIO_PATH with the path to its windows location.
I have also tried the suggested fixes on here CAPACITOR_ANDROID_STUDIO_PATH environment variable in Ionic 5 which also doesn't work
Wondering if anyone can help
Thanks
CodePudding user response:
Had the exact same error. My Android Studio is at a different location as I use the snap.
So first figure out where studio is:
which android-studio
And then add the variable to your .bashrc (or e.g. .zshrc):
echo export CAPACITOR_ANDROID_STUDIO_PATH="/snap/bin/android-studio" >> ~/.bashrc
Restart your terminal and it should work.