Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand the side menus crash the app on Android 2.3.7 #780

Closed
phuongnd08 opened this issue Mar 13, 2014 · 21 comments
Closed

Expand the side menus crash the app on Android 2.3.7 #780

phuongnd08 opened this issue Mar 13, 2014 · 21 comments
Assignees

Comments

@phuongnd08
Copy link

So I have the side menus:

 <body animation='slide-left-right-ios7' ng-app='giasu' ng-controller='MenuCtrl'>
    <ion-side-menus>
      <ion-pane ion-side-menu-content>
        <ion-nav-bar animation='nav-title-slide-ios7' back-button-icon='ion-ios7-arrow-back' back-button-type='button-icon button-clear' left-buttons='leftButtons' type='bar-positive'></ion-nav-bar>
        <ion-nav-view></ion-nav-view>
      </ion-pane>
      <ion-side-menu side='left'>
      </ion-side-menu>
    </ion-side-menus>
    <script src='lib/js/ionic.js'></script>
   ...
</body>

When I try to expand it:

D/CordovaLog( 1601): file:///android_asset/www/lib/js/angular/angular.js: Line 9435 : Result of expression 'node' [undefined] is not an object.
D/CordovaLog( 1601): file:///android_asset/www/lib/js/angular/angular-animate.js:877
E/Web Console( 1601): Result of expression 'node' [undefined] is not an object.
E/Web Console( 1601): file:///android_asset/www/lib/js/angular/angular-animate.js:877 at file:///android_asset/www/lib/js/angular/angular.js:9435
D/CordovaWebViewClient( 1601): onPageFinished(file:///android_asset/www/index.html#/tab/pets)
D/CordovaActivity( 1601): onMessage(onPageFinished,file:///android_asset/www/index.html#/tab/pets)
I/ActivityManager( 1111): Process com.giasu.mobile (pid 1601) has died.
I/WindowManager( 1111): WIN DEATH: Window{b65a82e0 com.giasu.mobile/com.giasu.mobile.GiaSu paused=false}
D/Zygote  ( 1045): Process 1601 terminated by signal (11)

The side menu works fine on android 4.1.1, but crashes on android 2.3.3

@mlynch
Copy link
Contributor

mlynch commented Mar 13, 2014

Wow, hmm. Looks like an issue with Angular almost. Thanks for the report. Which Android device specifically are on, just curious?

@phuongnd08
Copy link
Author

This is a Genymotion virtual device, emulate Android 2.3.7 as a Nexus One.

@phuongnd08
Copy link
Author

Any plan to deal with crash on Android 2.3.7? Everything works just fine but the crash would prevent us from releaseing app for Android 2.3.7 user?

@adamdbradley adamdbradley assigned adamdbradley and unassigned mlynch Apr 3, 2014
@mlynch
Copy link
Contributor

mlynch commented Apr 29, 2014

@phuongnd08 is this still an issue?

@adamdbradley
Copy link
Contributor

I found out that font icons, which are assigned within an :after selector, and also have a flexbox alignment, will usually crash older Android browsers. I've since updated lists to no longer use this method to assign the right nav arrow, but you may still have some buttons that could be causing this issue. Would you be able to test your app out again on 2.3? Thanks

@phuongnd08
Copy link
Author

I'm upgrading ionic to 1.0.0-beta2 and the left-buttons is not showing. I used to do this: left-buttons="leftButtons" but I guess the structure has changed?

@adamdbradley
Copy link
Contributor

Yes quite a bit has changed, but in the end the changes have been made so it's easier to develop:
https://github.com/driftyco/ionic/blob/master/CHANGELOG.md

@phuongnd08
Copy link
Author

I'm trying to use %ion-header-bar:

%ion-view
  %ion-header-bar
    .buttons
      %button.button.button-positive(ng-click="sideMenuController.toggleLeft()")
    %h1.title Introduction
  %ion-content(has-header="true" has-tabs="true")

But it looks obvious to me that %ion-view will ignore %ion-header-bar. If I set title to %ion-view, I get the title in the view. But how to add the buttons?

@adamdbradley
Copy link
Contributor

http://ionicframework.com/docs/api/directive/ionNavButtons/

Happy to help, but it'd be better to use the forum to answer any development questions like these, thanks.
http://forum.ionicframework.com/

@phuongnd08
Copy link
Author

Well, I think this is related to verify the issue itself, since I'm trying out the new version to check for issue existence. Btw, on Android 2.3.7, Web View is complaining about this kind of syntax:

$attr.$set('class', ($attr.class || '') + ' button icon button-icon', true);
D/CordovaLog( 1716): file:///android_asset/www/lib/js/ionic-angular.js: Line xxxx : SyntaxError: Parse error

@phuongnd08
Copy link
Author

@adamdbradley Thanks for pointing out how to render left buttons. I commented all the troublesome lines of ionic-angular.js and the app is rendering now. But as soon as I try to toggle the left side menu, the app (browser) crash.

@phuongnd08
Copy link
Author

I tried with nightly-1897 and does not encounter the syntax issue any more.
I'm trying to toggle the menu and getting this in ADB log:

I/ActivityManager( 1116): Process com.android.browser (pid 1988) has died.
I/WindowManager( 1116): WIN DEATH: Window{b66c0b18 com.android.browser/com.android.browser.BrowserActivity paused=false}
D/Zygote  ( 1045): Process 1988 terminated by signal (11)
W/InputManagerService( 1116): Got RemoteException sending setActive(false) notification to pid 1988 uid 10024

There was no sign of angular js error anymore.

@phuongnd08
Copy link
Author

FYI, I upgraded ionic.js, ionic-angular.js and ionic.css to their latest nightly build.

@phuongnd08
Copy link
Author

@adamdbradley @mlynch So this issue should be reopened, no?

@phuongnd08
Copy link
Author

After searching around, it seem that Android 2.3.7 browser would crash if it encounter -webkit-transition. https://code.google.com/p/android-x86/issues/detail?id=445&sort=-id I'm thinking about a way to disable -webkit-transition if the app happen to run on Android < 2.3.7

@ajoslin ajoslin reopened this May 2, 2014
@ajoslin
Copy link
Contributor

ajoslin commented May 2, 2014

I'll keep this open for now - when we switch to the new animation system, thisAndroid 2.x problem may actually fix itself.

@phuongnd08
Copy link
Author

Awesome. Meanwhile, I use a piece of javascript to check if browser is on Android 2.3 or lower, if yes then add a css selector that turn off all transition effect:

     var ua = navigator.userAgent;
      if( ua.indexOf("Android") >= 0 )
      {
        var androidversion = parseFloat(ua.slice(ua.indexOf("Android")+8));
        if (androidversion <= 2.3)
        {
          document.write("<style type='text/css'> * { transition: none!important; -webkit-transition: none!important; } </style>")
        }
      }

@adamdbradley
Copy link
Contributor

@phuongnd08 Great find, thanks! I added a pure CSS fix so it disables transitions on Android 2. I was able to replicate Android 2.3.7 with side menus crashing without the fix, and not crashing with the fix. Also, for those who still want to have Android 2 transitions they can add enable-transitions to the body class and the transition property will not be set to none.

@trumbitta
Copy link
Contributor

I'm having this issue on 2.3.7 (same geymotion vm as OP), but not on a real HTC Desire with cyanogenmod 2.3.3.
Ionic version is 1.0.0-beta.13.

I'm going to try the CSS fix and will let you know how it goes.

@trumbitta
Copy link
Contributor

It works with JS version of the CSS fix.

I used the following syntax due to JSHint complaining about document.write

   var ua = navigator.userAgent;
   if( ua.indexOf("Android") >= 0 )
   {
     var androidversion = parseFloat(ua.slice(ua.indexOf("Android")+8));
     if (androidversion <= 2.3)
     {
       var newScript = document.createElement("style");
       var content = document.createTextNode("* { transition: none!important; -webkit-transition: none!important; }");
       newScript.appendChild(content);
       var bodyClass = document.getElementsByTagName("head")[0];
       bodyClass.insertBefore(newScript, bodyClass.childNodes[2]);
     }
   }

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 6, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants