Exception on android when i start app or change page


When i start app or change page i got new exception.
"{“message”:“Error: Uncaught TypeError: Cannot read property ‘width’ of null\nurl: file:///android_asset/www/lib/js/ionic.bundle.js\nline #: 5485”}"

ON pc it works as well but not on android and i am using nightly build 1.0.0-beta.1-nightly-1768


From my own testing various things in nightly do not work with Cordova (which I imagine you are using). Use the beta version.


No answer for this, but through some investigation, it is coming from dom.js

ionic.bundle.js line 5485 (nightly 1768)

if(c.nodeType == 3) {
                                                                           childSize = ionic.DomUtil.getTextBounds(c).width;

which goes to ionic.bundle.js line 270 (nightly 1768)

 getTextBounds: function(textNode) {
  if(document.createRange) {
  var range = document.createRange();
  if(range.getBoundingClientRect) {
  var rect = range.getBoundingClientRect();
  if(rect) {
  var sx = window.scrollX;
  var sy = window.scrollY;
  return {
  top: rect.top + sy,
  left: rect.left + sx,
  right: rect.left + sx + rect.width,
  bottom: rect.top + sy + rect.height,
  width: rect.width,
  height: rect.height
  return null;

I am going to try to dig a bit deeper later, but maybe it will drop a breadcrumb for someone


You mind sharing a CodePen sample? I’ve just setup my first android phone and app (beta1 and nightly) from another forum post. It’s not having any such troubles. If you setup a CodePen sample, I can run it locally and see what’s going on.


did you build it with cordova?


I’m seeing the same error in my latest app: https://github.com/RangerRick/deluge-mobile

I’m building using cordova 3.4.1, running against the android emulator with android 4.1-4.3. It doesn’t happen with 4.4 (Which I guess is the first using Chromium under the covers?)


I have same issue too when showing the modal on android


This is happening to me as well. (On the default “ionic start project” project)

First time trying to use Ionic today. On an android 4.2.2 emulator this error is encountered and nothing in the example project loads but the text “Dash”.

If done instead in an android 4.4.2 emulator everything loads but there are other errors that happen any time any button is clicked on and none of the button presses actually accomplish anything.

Could anyone direct me to a more stable version I could begin experimenting with? At this point this is completely unusable. I’m using whatever latest version NPM installs.

Error occurs on both 4.2.2 and 4.3.0 emulators.
4.4.2 Emulator is apparently broken period due to use of chrome underneath requiring opengl access that doesn’t work well with emulation; will have to give it a try on a real device.


I can confirm the issue is still happening in Beta 5 of the Nightly Release - it happened in Beta 4. Only on device, and only when Chromium isn’t the default WebView (i.e pre 4.4.x)


Exceptions for Android Samsung

I have this in Beta 6 on android 4.2.2


Anyone have any solutions to this? I’m still getting it with Beta 7 on Android, doesn’t happen on iOS


I just updated the nightly build with the fix: https://github.com/driftyco/ionic/issues/1377