Android Studio not showing Logcat with Flutter

前端 未结 17 2355
长情又很酷
长情又很酷 2020-12-01 17:41

I\'m using Android Studio for Flutter App Development. Everything seems to be working fine just that the Android Studio does not show the \"logs\" in Logcat

相关标签:
17条回答
  • 2020-12-01 18:07

    You can enable verbose logging for flutter if you are looking for AppId or something of that sort.

    0 讨论(0)
  • 2020-12-01 18:08

    When I first came to Flutter from an Android background, I didn't know where to find the log statements. I didn't care so much about all of the system messages. I just wanted to see log messages from my app during development. This answer is for people like that, not for people who specifically need LogCat itself.

    In Flutter apps you can log text using the print() statement.

    print('hello');
    

    As others have said, you can use the Run tab in Android Studio to view these logged comments.

    Here is the code for main.dart:

    import 'package:flutter/material.dart';
    
    void main() {
      runApp(MaterialApp(
        home: Center(
          child: RaisedButton(
            child: Text('Button'),
            onPressed: () {
              print('hello'); //               <-- logging
            },
          ),
        ),
      ));
    }
    
    0 讨论(0)
  • 2020-12-01 18:09

    Update April 2020: Cuong's answer works better with Android Studio 3.6+


    Previous answer:

    Flutter use Run tab to display logs in Android Studio. Switch from Logcat to Run and then you will see logs.

    0 讨论(0)
  • 2020-12-01 18:12

    Open Project Stucture -> Modules -> new android module from exists source.

    Logcat & Device File Explorer will be visible.

    for Android Studio 3.6: File -> New -> New Module -> Android Library

    0 讨论(0)
  • 2020-12-01 18:12

    I had this issue: I have done the following steps to resolved it:

    • Click the event log on the bottom right of android studio
    • Click on configure
    • Click on Ok in the dialog box

    • Logcat will be available now
    0 讨论(0)
  • 2020-12-01 18:16

    Try Event Log > scroll to Android framework is detected > click Configure.

    This should make the Logcat visible with logs shown. Moreover, Device File Exprorer should show up on the right panel.

    0 讨论(0)
提交回复
热议问题