Android Studio not showing Logcat with Flutter

若如初见. 提交于 2019-12-17 16:32:44

问题


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. In the Logcat section, it says "Please Configure Android SDK". Which is already configured. And in the Logcat section says "No Connected Devices." in the drop-down menu. When it has recognized my Android Phone and is showing it just under the Menu bar.

Is there a fix for it? Is there something I am missing?


回答1:


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




回答2:


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




回答3:


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



回答4:


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.




回答5:


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




回答6:


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.




回答7:


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.




回答8:


Just use command 'flutter logs', then you can see all logs which are printed by 'print' or 'debugPrint' function.




回答9:


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

Logcat & Device File Explorer will be visible.




回答10:


When i face this problem I just go to File and open my existing native android project and then close it. This solution also works when abd Wifi pludings does show warning like => adb not found.



来源:https://stackoverflow.com/questions/51007784/android-studio-not-showing-logcat-with-flutter

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