0

I'm working on a mobile app using Meteor and ionic.

When I built the apk for android, the apk generated (release-unsigned.apk) didn't work on my device. It does show the splash screen, then it just shows a blank white screen and that's it. I run it in bluestacks and used remote debugging to figure out what wrong, and this error came up in the console:

    Uncaught Error: [$injector:modulerr] Failed to instantiate module SoldatyApp due to:
Error: [$injector:unpr] Unknown provider: e
http://errors.angularjs.org/1.4.8/$injector/unpr?p0=e
    at http://localhost:12312/fcfcd288ece9a0234fdb385aba26e0105b653b78.js?meteor_js_resource=true:113:484
    at http://localhost:12312/fcfcd288ece9a0234fdb385aba26e0105b653b78.js?meteor_js_resource=true:113:20192
    at r (http://localhost:12312/fcfcd288ece9a0234fdb385aba26e0105b653b78.js?meteor_js_resource=true:113:19362)
    at Object.i [as invoke] (http://localhost:12312/fcfcd288ece9a0234fdb385aba26e0105b653b78.js?meteor_js_resource=true:113:19699)
    at r (http://localhost:12312/fcfcd288ece9a0234fdb385aba26e0105b653b78.js?meteor_js_resource=true:113:18750)
    at http://localhost:12312/fcfcd288ece9a0234fdb385aba26e0105b653b78.js?meteor_js_resource=true:113:18874
    at o (http://localhost:12312/fcfcd288ece9a0234fdb385aba26e0105b653b78.js?meteor_js_resource=true:113:910)
    at p (http://localhost:12312/fcfcd288ece9a0234fdb385aba26e0105b653b78.js?meteor_js_resource=true:113:18651)
    at tt (http://localhost:12312/fcfcd288ece9a0234fdb385aba26e0105b653b78.js?meteor_js_resource=true:113:20341)
    at s (http://localhost:12312/fcfcd288ece9a0234fdb385aba26e0105b653b78.js?meteor_js_resource=true:113:7674)
http://errors.angularjs.org/1.4.8/$injector/modulerr?p0=SoldatyApp&p1=Error…e9a0234fdb385aba26e0105b653b78.js%3Fmeteor_js_resource%3Dtrue%3A113%3A7674) fcfcd288ece9a0234fdb385aba26e0105b653b78.js?meteor_js_resource=true:113

I should also mention that the debug.apk is working just fine.

EDIT:

I unpacked both the debug and the release apks: the difference is that the release apk has only two js files inn index.html: one named cordova.js and the other is the one triggering the error, whilst the debug apk has all the packages used in the project in index.html but I still don't know how to solve the problem: how can I make the packages included in the release apk?

younes sofiane
  • 441
  • 1
  • 8
  • 22
  • you can't make a request to your localhost using your device – Oussema Aroua May 11 '16 at 20:39
  • take a look http://stackoverflow.com/a/4779992/4063532 – Oussema Aroua May 11 '16 at 20:44
  • The problem is, that you inject an unknown provider in your anguar app. This normaly happens because of a syntax error or because some files arent included. I don't know meteor, but i assume that in release build they use minimize or something like that and this broke your app – Simon Schüpbach May 11 '16 at 20:44
  • @OussemaAroua If this would be the problem then the `debug.apk` won't work neither – Simon Schüpbach May 11 '16 at 20:47
  • @SimonSchüpbach That's what I'm thinking: it's a problem with minification. because the app is running as expected on the browser, and in debug mode, but it fails in the release – younes sofiane May 11 '16 at 20:48
  • Try to unpack your release build and then run the project in browser, maybe you will be get some helpful outputs – Simon Schüpbach May 11 '16 at 20:53
  • Can't you inspect it in Chrome over USB? – MasterAM May 11 '16 at 20:58
  • @SimonSchüpbach how can I do that? – younes sofiane May 11 '16 at 21:22
  • @MasterAM my phone is on android 4.1, so I can't inspect a webview but I did inspect the app on bluestacks, and it gave me the error I posted – younes sofiane May 11 '16 at 21:24
  • unpack the *.apk an then just open the index.html – Simon Schüpbach May 11 '16 at 21:24
  • After following the advice of @SimonSchüpbach, I unpacked both the debug and the release apks: the difference is that the release apk has only two js files inn index.html: one named cordova.js and the other is the one triggering the error, whilst the debug apk has all the packages used in the project in index.html but I still don't know how to solve the problem: how can I make the packages included in the release apk? – younes sofiane May 11 '16 at 22:27

1 Answers1

1

After posting the question in meteor forums, one of the MDG staff (Urigo) suggested that I ran the app in angular's strictDi

https://docs.angularjs.org/guide/di

I found out that there was a problem with onEnter of ui-router, because I wrote it like this:

onEnter:function($state){

 //code here
}

But in fact I should have wrote it like this:

onEnter:['$state',function($state){

 //code here
}]

And of course it goes without saying that this should be applied to controllers, services... too For more details, read this: https://docs.angularjs.org/error/$injector/strictdi

This might help too: https://gist.github.com/jonnolen/fff606247f24cae8e81d

younes sofiane
  • 441
  • 1
  • 8
  • 22