Ionic v4 getting started tutorial always returns `cordova_not_available`

#1

Has anyone run through the recently released tutorial at:

It had a few issues where it referred to incorrect pages, which I opened PR requests for (https://github.com/ionic-team/ionic-docs/pull/243) but I have got stuck now.

I am on the second page (https://beta.ionicframework.com/docs/developer-resources/guides/first-app-v4/ios-android-camera/) to the point where it tells me to launch it in DevApp and try taking a photo. I only get cordova_not_available no matter what I try.

I tried rolling the camera plugin and friends back to Beta 20 after following one thread saying there are issues.

I tried installing the ionic cordova platform add android which it lists as a later step in case the writer hadn’t realised it was required earlier - I thought maybe they already had it installed which is hard to catch these things.

It’s just not working for me.

λ ionic info

Ionic:

   ionic (Ionic CLI)             : 4.6.0 (C:\Users\rtpha\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.0.0-rc.0
   @angular-devkit/build-angular : 0.11.4
   @angular-devkit/schematics    : 7.1.4
   @angular/cli                  : 7.1.4
   @ionic/angular-toolkit        : 1.2.2

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.1.4
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.1, (and 5 other plugins)

System:

   NodeJS : v10.13.0 (C:\Program Files\nodejs\node.exe)
   npm    : 6.4.1
   OS     : Windows 10
1 Like
#2

I’m having the exact same issue as you @rtpHarry.

Haven’t used Ionic since Version 1, and I’m coming back into trying to learn version 4, following the tutorial and using the DevApp on my phone. I have been able to follow along up until this point (though there are some minor differences between the source code files in the examples and how v4 looks now), however I can’t proceed past this point.

I changed the console.log error message to alert (since pressing the camera button did not do anything), and the app now shows an alert box stating Camera issue:cordova_not_available

1 Like
#3

Hi there, apologies for the issue. I tested locally - all is well. Looks like DevApp is the issue here.

For the time being, I recommend running a local Android build instead. Follow these setup instructions, then execute this in a terminal:

ionic cordova run android -l

#4

Hi @netkow, thanks for the helpful response.

I just saw that the newest version of Ionic DevApp was released on the Play store for Android, and states that it is compatible with Ionic version 4.10 (which I am currently running). However, this issue still persists for me with the newest version of DevApp and the CLI. Should this be working with this version, or is this still a known issue?

I also have tried to follow the instructions to run the tutorial app through the actual Android emulator, but I am running into an issue because I am using WSL (Ubuntu Linux Subsystem with Windows 10). I have installed Java and Android studio for Windows, and aliased the correct paths to the Windows executables but it is not working - everything seems to be starting up fine, then it crashes. From what I understand, I need to run the Windows version of Android Studio (and I’m assuming Windows Java as well) since WSL can’t currently access USB devices nor has a GUI.

Here’s the error it gives me while running ionic cordova run android -l --verbose:

3707 segmentation fault (core dumped)

Please let me know if you have any ideas on how to get Ionic Android emulator to work through WSL (or the new version of DevApp). Thanks!

#5

Another update. I found the root of the issue: to run an app on DevApp, we first need to add a reference to cordova.js in your index.html file. Open up the file at src/index.html and add the following tag into the section.

Note: Usually running a “cordova build” command will add this script tag into the index.html file for us. But since we are skipping that step and using DevApp, we have to do it manually ourselves. It’s not optimal, I know :slight_smile: but it’s required after a result of efforts to expand Ionic apps to other platforms and capabilities, such as PWAs.

As for Jason’s issue with the seg fault, the best path forward would be to post an issue here so our team can take a look. Thanks!

#6

Perfect! Adding <script src="cordova.js"></script> to index.html allowed DevApp to work with Cordova plugins. Great, thanks!

The only other issue I have been having with DevApp is that it I have not ever been able to have it automatically connect, I have to manually enter the IP address & port each time (on the same private network with no firewall). Not sure if I’m doing anything incorrectly, but would be amazing if there is a way to get it to successfully auto-connect.

1 Like