Ionic + Firebase not work android


#1

In android

“Module ‘firebase’ 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”

Ionic serve it works without problem

P.S: withelist is istalled


#2

A little code might help here?


#3

index.html
`

<!-- cordova script (this will be a 404 during development) -->
<script src="lib/ngCordova/dist/ng-cordova.js"></script>
<script src="cordova.js"></script>

<!-- Firebase -->
<script src="https://cdn.firebase.com/js/client/2.4.0/firebase.js"></script>

<!-- AngularFire -->
<script src="https://cdn.firebase.com/libs/angularfire/1.2.0/angularfire.min.js"></script>`

db.js
angular.module('db', ['firebase'])

ionic info

Cordova CLI: 6.0.0
Ionic Version: 1.2.4
Ionic CLI Version: 1.7.14
Ionic App Lib Version: 0.7.0
OS: Windows 8.1
Node Version: v4.3.2

Cordova plugin list

cordova-plugin-device 1.1.1 "Device"
cordova-plugin-whitelist 1.2.1 “Whitelist”

Thanks


#4

have you tried to include the firebase.js instead of using the https cdn? it could be that https is bounced. Its an easy way to test, and without any more code its hard to see.


#5

this works, but in android return error message “Unable to contact the Firebase server”

`

<script src="lib/firebase/angularfire.min.js"></script>`

db.js

`angular.module(‘db’, [‘firebase’])

.factory(“database”, function($firebaseArray,$localstorage,$q) {
var uri = ‘https://uri.firebaseio.com/’;
return {
getRef: function(){
var ref = new Firebase(uri);
return ref;
},
getRefById: function(tabela,id) {
var data = new Firebase(uri+tabela+"/"+id);
return data;
}
}
})`

P.S: ionic serve works


#6

Did you also include:

allow-intent href="*.firebaseio.com" />
allow-intent href=“auth.firebase.com” />

in the config.xml?

otherwise try with http instead of https.

and otherwise try to debug with chrome (https://developer.chrome.com/devtools/docs/remote-debugging)


#7

Reinstall plugin whitelist is work;
thank to help