user1532669
user1532669

Reputation: 2378

ionic: Failed to instantiate module ngCordova

This is the error I get after installing the geolocation plugin and ngCordova:

E/AndroidProtocolHandler: Unable to open asset URL: file:///android_asset/www/lib/ngCordova/dist/ng-cordova.js
D/JsMessageQueue: Set native->JS mode to OnlineEventsBridgeMode
E/ConnectivityManager.CallbackHandler: callback not found for RELEASED message
I/chromium: [INFO:CONSOLE(17922)] "Uncaught Error: [$injector:modulerr] Failed to instantiate module restaurant due to:
            Error: [$injector:modulerr] Failed to instantiate module ngCordova due to:
            Error: [$injector:nomod] Module 'ngCordova' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
            http://errors.angularjs.org/1.5.3/$injector/nomod?p0=ngCordova

I've run the following commands:

C:\Users\G\takeaway>ionic plugin add cordova-plugin-geolocation
Fetching plugin "cordova-plugin-geolocation" via npm
Installing "cordova-plugin-geolocation" for android
Fetching plugin "cordova-plugin-compat" via npm
Installing "cordova-plugin-compat" for android

C:\Users\G\takeaway>bower install ngCordova
bower                     invalid-meta for:C:\Users\G\takeaway\bower.json
bower                     invalid-meta The "name" is recommended to be lowercase, can contain digits, dots, dashes
bower ionic#1.3.2               cached https://github.com/driftyco/ionic-bower.git#1.3.2
bower ionic#1.3.2             validate 1.3.2 against https://github.com/driftyco/ionic-bower.git#1.3.2
bower ngCordova#*               cached https://github.com/driftyco/ng-cordova.git#0.1.27-alpha
bower ngCordova#*             validate 0.1.27-alpha against https://github.com/driftyco/ng-cordova.git#*
bower ionic#1.3.2              install ionic#1.3.2
bower                          skipped ionic was not installed because there is already a non-bower directory with that name in the components directory (www\lib\ionic). You can force installation with --force.
ionic#1.3.2 ..\AppData\Local\bower\cache\packages\75785deacc09255f971c33542b04c50a\1.3.2
├── angular#1.5.3
├── angular-animate#1.5.3
├── angular-sanitize#1.5.3
└── angular-ui-router#0.2.13

C:\Users\G\takeaway>

I'm including the file as per the docs. I'm also including the module in my code:

var app = angular.module('restaurant', ['ionic', 'ngCordova', 'firebase']);

The ngCordova files are present at this location:

C:\Users\G\takeaway\www\lib\ngCordova\dist

Here's my code:enter image description here

Upvotes: 0

Views: 1687

Answers (1)

user1532669
user1532669

Reputation: 2378

I've got this fixed. Had to copy the ngCordova directory to:

C:\Users\G\takeaway\platforms\android\assets\www\lib 

Upvotes: 1

Related Questions