I'm working through an Ionic/React getting-started, on my Linux Mint box.
Building an Ionic application using React
The first steps went well enough, but when I get to Deploying your application to iOS and Android Step 5, I get errors.
The instructions:
Open your project in Android Studio using the following command:
npx cap open android
First I got pathing errors:
events.js:174
throw er; // Unhandled 'error' event
^
Error: spawn /usr/local/android-studio/bin/studio.sh
ENOENT
That seemed simple enough. That's not where android studio is installed on my machine.
I did some googling around, and some grepping in node_modules, and discovered the "androidStudioPath" setting. I tried adding it to my project's capacitor.config.json file, and it made no difference. So I looked at the code a bit more carefully, and then added it in a "linux" object:
{
"appId": "us.jdege.mytestapp",
"appName": "mytestapp",
"bundledWebRuntime": false,
"npmClient": "npm",
"webDir": "build",
"linux": {
"androidStudioPath": "/var/.../studio.sh"
}
}
From all I can tell, this is the right setting, and I'm setting the right path. But it's being ignored.
jdege@linux-2016 ~/react-projects/mytestapp $ npx cap open android
[info] Opening Android project at /home/jdege/react-projects/mytestapp/android
events.js:174
throw er; // Unhandled 'error' event
^
Error: spawn /usr/local/android-studio/bin/studio.sh ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
How do I set the proper path to Android Studio in Ionic/Capacitor?
CAPACITOR_ANDROID_STUDIO_PATH
didn't work. – Odilia