Have built a simple camera app in Ionic 3 using Cordova and everything worked fine and the Camerea came up in Ionic Devap.
Did the same thing for Ionic 4 and not working. First off Ionic 4 loaded the @ionic-native/camera version ^4.15.0 which produced error
Uncaught TypeError: Object(...) is not a function
at index.js:200
at Object../node_modules/@ionic-native/camera/index.js (index.js:260)
at __webpack_require__ (bootstrap:81)
upgrading ^4.15.0 to ^5.0.0-beta.14 and changing the import routine from
import { Camera } from '@ionic-native/camera';
to
import { Camera } from '@ionic-native/camera/ngx';
solved the problem (thanks to the forums).
Now,however, while showing on Ionic Devapp, pressing the “take Photo” button does nothing. There are no errors, messages or console logs, just nothing. Also running Ionic Cordova emulate Android produces a blank screen, not even the home page is showing.
So turned to Capacitor with Ionic 4 and running npx cap open android get a gradle error
Cause: com.novoda.gradle.release.AndroidLibrary$LibraryUsage.getDependencyConstraints()Ljava/util/Set;
This is the standard 4.6 gradle from Android Studio 3.2.1. I pointed it to 4.10.2 and it runs OK. Now when the app opens in the emulator I get the Capacitor splash-screen then an error
(intermediate value).fill is not a function
TypeError: (intermediate value).fill is not a function
at Object.push../node_modules/@angular/core/fesm5/core.js (https://localhost:4638/vendor.js:44497:46)
with “@angular/core”: “~6.1.1”
So could someone put up a simple project that uses the phone’s camera to display a photo in an img tag that uses (a) cordova or (b) capacitor and could they also outline the steps taken (or versions modified) to achieve this because the steps as described in Ionic 3 tutorials don’t work for Ionic 4, or the versions are off, or something.