Skip to content

Managing State Tutorial Crashes Galaxy s6 #362

Closed

Description

@MicroSpecWes

I tried running the Managing State Tutorial on my Galaxy S6 Edge and I can use the app for a few seconds and then it will either show a black screen or a red screen. It will crash whether I use the button to increment the counter or not, but it will increment.

Here is the code I am running:

import 'package:flutter/material.dart';

void main() {
  runApp(
    new MaterialApp(
      title: 'Flutter Leads',
      routes: {
        '/': (RouteArguments args) => new Counter()
      }
    )
  );
}

class Counter extends StatefulComponent {
  _CounterState createState() => new _CounterState();
}

class _CounterState extends State<Counter> {
  int _count = 0;

  void _increment() {
    setState(() { ++_count; });
  }

  Widget build(BuildContext context) {
    return new Row([
      new RaisedButton(
        onPressed: _increment,
        child: new Text('Increment')
      ),
      new Text('Count: $_count')
    ]);
  }
}

This is the error I got:

android: I/sky     : Exception caught while building Navigator-[GlobalObjectKey _MaterialAppState(43269391)]
android: I/sky     : Bad state: No element
android: I/sky     : Stack trace:
android: I/sky     : #0      List.first (dart:core-patch/growable_array.dart:206)
android: I/sky     : #1      NavigatorState.build (packages/flutter/src/widgets/navigator.dart:119)
android: I/sky     : #2      ComponentElement.performRebuild (packages/flutter/src/widgets/framework.dart:1050)
android: I/sky     : #3      BuildableElement.rebuild (packages/flutter/src/widgets/framework.dart:991)
android: I/sky     : #4      StatefulComponentElement.update (packages/flutter/src/widgets/framework.dart:1149)
android: I/sky     : #5      Element.updateChild (packages/flutter/src/widgets/framework.dart:637)
android: I/sky     : #6      ComponentElement.performRebuild (packages/flutter/src/widgets/framework.dart:1062)
android: I/sky     : #7      BuildableElement.rebuild (packages/flutter/src/widgets/framework.dart:991)
android: I/sky     : #8      StatelessComponentElement.update (packages/flutter/src/widgets/framework.dart:1095)
android: I/sky     : #9      Element.updateChild (packages/flutter/src/widgets/framework.dart:637)
android: I/sky     : #10     ComponentElement.performRebuild (packages/flutter/src/widgets/framework.dart:1062)
android: I/sky     : #11     BuildableElement.rebuild (packages/flutter/src/widgets/framework.dart:991)
android: I/sky     : #12     ProxyElement.update (packages/flutter/src/widgets/framework.dart:1186)
android: I/sky     : #13     Element.updateChild (packages/flutter/src/widgets/framework.dart:637)
android: I/sky     : #14     ComponentElement.performRebuild (packages/flutter/src/widgets/framework.dart:1062)
android: I/sky     : #15     BuildableElement.rebuild (packages/flutter/src/widgets/framework.dart:991)
android: I/sky     : #16     ProxyElement.update (packages/flutter/src/widgets/framework.dart:1186)
android: I/sky     : #17     Element.updateChild (packages/flutter/src/widgets/framework.dart:637)
android: I/sky     : #18     ComponentElement.performRebuild (packages/flutter/src/widgets/framework.dart:1062)
android: I/sky     : #19     BuildableElement.rebuild (packages/flutter/src/widgets/framework.dart:991)
android: I/sky     : #20     ProxyElement.update (packages/flutter/src/widgets/framework.dart:1186)
android: I/sky     : #21     Element.updateChild (packages/flutter/src/widgets/framework.dart:637)
android: I/sky     : #22     ComponentElement.performRebuild (packages/flutter/src/widgets/framework.dart:1062)
android: I/sky     : #23     BuildableElement.rebuild (packages/flutter/src/widgets/framework.dart:991)
android: I/sky     : #24     ProxyElement.update (packages/flutter/src/widgets/framework.dart:1186)
android: I/sky     : #25     Element.updateChild (packages/flutter/src/widgets/framework.dart:637)
android: I/sky     : #26     ComponentElement.performRebuild (packages/flutter/src/widgets/framework.dart:1062)
android: I/sky     : #27     BuildableElement.rebuild (packages/flutter/src/widgets/framework.dart:991)
android: I/sky     : #28     WidgetFlutterBinding.buildDirtyElements.<anonymous closure> (packages/flutter/src/widgets/binding.dart:55)
android: I/sky     : #29     BuildableElement.lockState (packages/flutter/src/widgets/framework.dart:924)
android: I/sky     : #30     WidgetFlutterBinding.buildDirtyElements (packages/flutter/src/widgets/binding.dart:50)
android: I/sky     : #31     WidgetFlutterBinding.beginFrame (packages/flutter/src/widgets/binding.dart:26)
android: I/sky     : #32     FlutterBinding._handlePersistentFrameCallback (packages/flutter/src/rendering/binding.dart:176)
android: I/sky     : #33     Scheduler.invokeCallback (packages/flutter/src/animation/scheduler.dart:81)
android: I/sky     : #34     Scheduler.beginFrame (packages/flutter/src/animation/scheduler.dart:67)
android: I/sky     : #35     _beginFrame (file:///src/flutter/engine/src/out/android_Release/gen/sky/bindings/Customhooks.dart:30)

Activity

  1. abarth commented on Nov 13, 2015

    @abarth
    Contributor

    Thanks for the report. That's very strange. We'll need to try replicating the issue on our end.

  2. MicroSpecWes commented on Nov 13, 2015

    @MicroSpecWes
    Author

    I removed the RaisedButton and changed Text to just plain text, it seems to sit there and doesn't crash, but if you tap the screen it will do some sort of fade down animation, and then the screen is black. I am having a hard time recreating the red screen.

  3. modified the milestone: on Nov 21, 2015
  4. sethladd commented on Sep 20, 2016

    @sethladd
    Contributor

    A ton of code has changed here. Going to close with the hopes that it's working for you. If not, we'll reopen and take a look.

    Thanks for the report! Please give it a shot again and let us know.

  5. github-actions commented on Aug 17, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  6. locked as resolved and limited conversation to collaborators on Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: crashStack traces logged to the console

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions