flutter run and debug mode only shows white screen in physical android device
finally, I have solved the above problem, I was try run my app using direct command
flutter run
in the project directory, hopefully, it was worked on my device, after that, I checked my IntelliJ idea updates and plugin versions, the issue is there then I updated flutter related all dart and plugins. after it was worked as I want.
Manoj Madushanka
I am Manoj Madushanka and living in Sri Lanka. I earned a Bsc computer science degree from the University of Colombo School of computer and now I work as an associate software engineer in Sri Lankan software company.
Updated on December 28, 2022Comments
-
Manoj Madushanka over 1 year
recently I upgraded my flutter version to the most recent stable versions using the below commands
flutter channel stable flutter upgrade
but after updating success I created totally new flutter project using intellij idea. I did not change anything of that project then I run that project selecting my connected android device. logs do not show any error message but my device screen show only white screen. below is my pubspec.yml
name: test_wite description: A new Flutter project. # The following line prevents the package from being accidentally published to # pub.dev using `pub publish`. This is preferred for private packages. publish_to: 'none' # Remove this line if you wish to publish to pub.dev # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43 # followed by an optional build number separated by a +. # Both the version and the builder number may be overridden in flutter # build by specifying --build-name and --build-number, respectively. # In Android, build-name is used as versionName while build-number used as versionCode. # Read more about Android versioning at https://developer.android.com/studio/publish/versioning # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html version: 1.0.0+1 environment: sdk: ">=2.7.0 <3.0.0" dependencies: flutter: sdk: flutter # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 dev_dependencies: flutter_test: sdk: flutter # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec # The following section is specific to Flutter. flutter: # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. uses-material-design: true # To add assets to your application, add an assets section, like this: # assets: # - images/a_dot_burr.jpeg # - images/a_dot_ham.jpeg # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware. # For details regarding adding assets from package dependencies, see # https://flutter.dev/assets-and-images/#from-packages # To add custom fonts to your application, add a fonts section here, # in this "flutter" section. Each entry in this list should have a # "family" key with the font family name, and a "fonts" key with a # list giving the asset and other descriptors for the font. For # example: # fonts: # - family: Schyler # fonts: # - asset: fonts/Schyler-Regular.ttf # - asset: fonts/Schyler-Italic.ttf # style: italic # - family: Trajan Pro # fonts: # - asset: fonts/TrajanPro.ttf # - asset: fonts/TrajanPro_Bold.ttf # weight: 700 # # For details regarding fonts from package dependencies, # see https://flutter.dev/custom-fonts/#from-packages
and this is my updated versions
C:\Users\Manoj>flutter doctor --version
Flutter 2.0.2 • channel stable • https://github.com/flutter/flutter.git Framework • revision 8962f6dc68 (33 hours ago) • 2021-03-11 13:22:20 -0800 Engine • revision 5d8bf811b3 Tools • Dart 2.12.1
C:\Users\Manoj>flutter --version
Flutter 2.0.2 • channel stable • https://github.com/flutter/flutter.git Framework • revision 8962f6dc68 (33 hours ago) • 2021-03-11 13:22:20 -0800 Engine • revision 5d8bf811b3 Tools • Dart 2.12.1
and below is showing my logs in debug mode
Launching lib\main.dart on LDN L21 in debug mode... Running Gradle task 'assembleDebug'... √ Built build\app\outputs\flutter-apk\app-debug.apk. Debug service listening on ws://127.0.0.1:60561/IXRvODY4qNg=/ws Syncing files to device LDN L21... I/hwaps (15984): JNI_OnLoad V/InputMethodManager(15984): Reporting focus gain, without startInput I/zygote64(15984): Do partial code cache collection, code=29KB, data=25KB I/zygote64(15984): After code cache collection, code=29KB, data=25KB I/zygote64(15984): Increasing code cache capacity to 128KB I/zygote64(15984): Do partial code cache collection, code=61KB, data=47KB I/zygote64(15984): After code cache collection, code=61KB, data=47KB I/zygote64(15984): Increasing code cache capacity to 256KB
here is my main.dart file
import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { // This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( // This is the theme of your application. // // Try running your application with "flutter run". You'll see the // application has a blue toolbar. Then, without quitting the app, try // changing the primarySwatch below to Colors.green and then invoke // "hot reload" (press "r" in the console where you ran "flutter run", // or simply save your changes to "hot reload" in a Flutter IDE). // Notice that the counter didn't reset back to zero; the application // is not restarted. primarySwatch: Colors.blue, ), home: MyHomePage(title: 'Flutter Demo Home Page'), ); } } class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); // This widget is the home page of your application. It is stateful, meaning // that it has a State object (defined below) that contains fields that affect // how it looks. // This class is the configuration for the state. It holds the values (in this // case the title) provided by the parent (in this case the App widget) and // used by the build method of the State. Fields in a Widget subclass are // always marked "final". final String title; @override _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { int _counter = 0; void _incrementCounter() { setState(() { // This call to setState tells the Flutter framework that something has // changed in this State, which causes it to rerun the build method below // so that the display can reflect the updated values. If we changed // _counter without calling setState(), then the build method would not be // called again, and so nothing would appear to happen. _counter++; }); } @override Widget build(BuildContext context) { // This method is rerun every time setState is called, for instance as done // by the _incrementCounter method above. // // The Flutter framework has been optimized to make rerunning build methods // fast, so that you can just rebuild anything that needs updating rather // than having to individually change instances of widgets. return Scaffold( appBar: AppBar( // Here we take the value from the MyHomePage object that was created by // the App.build method, and use it to set our appbar title. title: Text(widget.title), ), body: Center( // Center is a layout widget. It takes a single child and positions it // in the middle of the parent. child: Column( // Column is also a layout widget. It takes a list of children and // arranges them vertically. By default, it sizes itself to fit its // children horizontally, and tries to be as tall as its parent. // // Invoke "debug painting" (press "p" in the console, choose the // "Toggle Debug Paint" action from the Flutter Inspector in Android // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) // to see the wireframe for each widget. // // Column has various properties to control how it sizes itself and // how it positions its children. Here we use mainAxisAlignment to // center the children vertically; the main axis here is the vertical // axis because Columns are vertical (the cross axis would be // horizontal). mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Text( 'You have pushed the button this many times:', ), Text( '$_counter', style: Theme.of(context).textTheme.headline4, ), ], ), ), floatingActionButton: FloatingActionButton( onPressed: _incrementCounter, tooltip: 'Increment', child: Icon(Icons.add), ), // This trailing comma makes auto-formatting nicer for build methods. ); } }
can anyone help me resolve this issue, please?
-
Pratik Butani about 3 yearsHave you checked logcat when you run app. May be you have some design error.
-
Akshay Nayka about 3 yearsdo you have warning while running the app
-
Manoj Madushanka about 3 yearsI did not get any warning or error, I did not use logcat because it is a totally new project, I did not change anything of it.
-
Pratik Butani about 3 yearsHave you updated dart?
-
Manoj Madushanka about 3 yearsno did not update dart only run flutter update commands
-
Manoj Madushanka about 3 yearsdart version is 2.12.1
-
Manoj Madushanka about 3 yearsupdated dart also but the issue still there
-
Victor Eronmosele about 3 yearsHi, can you try running in another device or emulator with the same code / system ?
-
Manoj Madushanka about 3 yearstried that also sir got the same result
-
-
Gitesh over 2 yearsIt works for me. Thanks !