Android apk release build not working


#1

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.

I guess it’s a problem occurring after minification. so how can I solve it?


#2

After unpacking both debug apk and release apk, I found out that index.html of the debug contains all the packages used in the projects called in a script tag, whilst index.html of the release has only two javascript files: cordova.js, and the long name file that causes the error above: fcfcd288ece9a0234fdb385aba26e0105b653b78.js

@martijnwalraven says that the packages are all included in the release build but are minified.
I think maybe that’s what the second javascript is for.
But still I can’t figure out what went wrong.


#3

Have you tried running the app with Angular’s strict-di in developement?
It might help you find it you haven’t minified some of the modules right


#4

I tried running with strict-di, and I found that the problem was with a ui-router function : onEnter, because it used $state without injecting it. Now everything works fine.
Thanks for the suggestion @Urigo