0

I'm a beginner to flutter. I use vscode for development. I also debug using my physical android device instead of an emulator. I built a simple flutter application. Executed using flutter run. After building, white screen popped in my phone and soon followed by the dialogue "Unfortunately, quiz_app has stopped.", where quiz_app is the project name. I have a Ryzen-5 Machine. Here is the output of $ flutter -v:

[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.720], locale en-IN)
    • Flutter version 1.12.13+hotfix.8 at C:\src\flutter
    • Framework revision 0b8abb4724 (5 weeks ago), 2020-02-11 11:44:36 -0800
    • Engine revision e1e6ced81d
    • Dart version 2.7.0

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at C:\Users\haari\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
    • All Android licenses accepted.

[!] Android Studio (version 3.6)
    • Android Studio at C:\Program Files\Android\Android Studio
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

This is the console log when I do $ flutter run :

Launching lib\main.dart on SM G531F in debug mode...
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                        20.0s
√ Built build\app\outputs\apk\debug\app-debug.apk.
D/FlutterActivity( 8697): Using the launch theme as normal theme.
D/FlutterActivityAndFragmentDelegate( 8697): Setting up FlutterEngine.
D/FlutterActivityAndFragmentDelegate( 8697): No preferred FlutterEngine was provided. Creating a new FlutterEngine for this FlutterFragment.
E/DartVM  ( 8697): version=2.7.0 (Fri Dec 6 16:26:51 2019 +0100) on "android_arm"
E/DartVM  ( 8697): thread=8697, isolate=vm-isolate(0xab699540)
E/DartVM  ( 8697):   pc 0x54cfcfcd fp 0xffcb8e58 libflutter.so+0x1321fcd
E/DartVM  ( 8697): -- End of DumpStackTrace

Here is the main.dart code:-

import 'package:flutter/material.dart';

void main() => runApp(QuizApp());

class QuizApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('JIT Quiz App'),
        ),
        body: Column(
          children: <Widget>[
            Text('What is your favourite subject?'),
            RaisedButton(child: Text('DBMS'), onPressed: null),
            RaisedButton(child: Text('DAA'), onPressed: null),
            RaisedButton(child: Text('CA'), onPressed: null),
            RaisedButton(child: Text('PQT'), onPressed: null),
          ],
        ),
      ),
    );
  }
}

I am trying to avoid debugging using an emulator as much as possible.

hsiraaH
  • 5
  • 1
  • 7

3 Answers3

0

You should return the MaterialApp() first. MaterialApp is the starting point of your apps. It tells flutter that you will be using material components in your app.

  • Thank you for your advice, a very blunt mistake from my end. But that hasn't yet solved my problem. – hsiraaH Mar 18 '20 at 13:07
0

Open your android project from Android Studio and then run the application in your device. You will then able to see the proper error message in your console due to which your app was crashing.

This is the location to your main android project

Suman Maharjan
  • 1,070
  • 7
  • 14
0

Step 01: Add internet permission in android/app/src/AndroidManifest.xml just like this

   <manifest xmlns:android="http://schemas.android.com/apk/res/android">
        <uses-permission android:name="android.permission.INTERNET" />
        <application

Step 02: In android/app/build.gradle add

   >  buildTypes {
    >         release {
    >             // TODO: Add your own signing config for the release build.
    >             // Signing with the debug keys for now, so `flutter run --release` works.
    >             signingConfig signingConfigs.debug
    >             minifyEnabled false
    >             shrinkResources false
    >             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    >         }
    >     }

It worked for me.

Muktadir Sony
  • 344
  • 4
  • 9
  • I don't have access to that project anymore to check this answer out and I am not into flutter development anymore as well. If anyone else finds this solution working kindly let me know so that I can mark this as the accepted answer. Thanks in advance. – hsiraaH Jul 27 '23 at 05:59