Android Studio not showing Logcat with Flutter

吃可爱长大的小学妹 提交于 2019-11-28 00:40:50
Daniil Yakovlev

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

Go to Setting/Preferences -> Languages & Framework -> Flutter -> Check or uncheck Replace the Run and Debug console with an experimental Flutter Loggin view

Suragch

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
        },
      ),
    ),
  ));
}
Jaswant Singh

Switch to the “Run” tab to see the logs and if you want to insert logs (like Log.d() in android), you can use print() function and whatever string you pass into it will be printed into the “Run” window.

I guess it's an ADB issue. You can restart AS (or maybe even your Computer) or what i usually do is open the terminal an then: adb kill-server && adb start-server (I think the second part adb start-server is not necessary because it seems that AS handles it automatically) - anyways this is how LogCat and Android (and Flutter) work for me every time.

Sam

Flutter has not logcat flutter show error in the console inside Run tab.IF you want to see error and crash report click on run tab.

Just open another NATIVE project for Android Studio in other window and the logcat will work, do it while Flutter project is open. That was the solution for me

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!