When you have a Flutter project open in Android Studio or VSCode, and you run it (either on a real device or emulator), you have a debug window available where you can see your print messages.
Does the "flutter logs" command show the exact same thing as this?
If not, what accounts for the difference?
The "flutter logs" command is used to display log output in the terminal, while the IDE debug window is used to display log output in the integrated development environment (IDE) such as Android Studio or Visual Studio Code. The "flutter logs" command is useful for viewing log output when running the app from the command line, while the IDE debug window is useful for viewing log output when running the app from within the IDE. Both of these tools display the same log output, but in different locations.
Related
I connected physical android device via USB to my computer(windows) and I try to debug flutter project on it. The project was just created by command on terminal of VScode.
flutter create my_mobile_app
and when I push debug/run button, it returns like this and crash.
Launching lib\main.dart on SM J727S in debug mode...
main.dart:1
����: �⺻ Ŭ���� org.gradle.wrapper.GradleWrapperMain��(��) ã�ų� �ε��� �� �����ϴ�.
����: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
How can I run/debug the program I made on my physical device? is it related with java? should I install or reinstall smth?
The device i'm using is samsung sm-j727s
I tried reconnecting the device from computer and run on android studio but it doesn't make any changes, the divice is visible in the Device manager of android studio and flutter doctor shows every components are green.
Are you try run your project on simulator devices yet?. It makes the same error or not ? Are you design any widgets on screen or just a blank screen ?
You can give it a shot to run some commands below a re-run your project
$flutter analyze
$flutter pub get
$flutter pub upgrade
Could not find an option with short name "-n".
Run 'flutter -h' (or 'flutter -h') for available flutter commands and options.
Exited (64)
It sounds like some unexpected arguments are being passed to flutter when you try to run. These could come from a few different places:
Check if you have a .vscode/launch.json file, and whether you have anything unexpected in the args
Check the "Flutter Additional Args" and other similar settings in VS Code
To find out exactly what command VS Code is trying to run:
Run the Dart: Capture Debugging Logs command from the command palette
Try to run the app to generate the error
Click Cancel on the logging notification to stop logging and open the log file
Search the log file for "Spawning" and it should show the full command VS Code is trying to run
My environment.
Windows 10 with Android SDK and AVD Manager and VS Code 1.26.1
Android Nexus S simulator with SDK API 23 Android 6.0 x86_64
react-native: 0.55.4
Problem:
I am failing to debug my sample app.js in Visual Studio Code IDE and fail to stop at any breakpoint.
I have AVD emulator running and when I simply run my simple project, the simulator loads it without issues. So, I do not see a problem with my project.
I also can execute “react-native run-android” in Terminal window of VS Code IDE and it returns success, for example:
BUILD SUCCESSFUL Total time: 10.283 secs Running
C:\Users\myusername\AppData\Local\Android\Sdk/platform-tools/adb -s
emulator-5554 reverse tcp:8081 tcp:8081 Starting the app on
emulator-5554
(C:\Users\myusername\AppData\Local\Android\Sdk/platform-tools/adb -s
emulator-5554 shell am start -n
com.vscodereactdebug3/com.vscodereactdebug3.MainActivity)... Starting:
Intent { cmp=com.vscodereactdebug3/.MainActivity }
However, when I attempt to debug it through Visual Studio IDE (Debug/Start Debugging), the Debug Console shows the following:
OS: win32 x64 Adapter node: v8.9.3 x64 vscode-chrome-debug-core: 3.17.3 Could not debug. Unknown error: not all success patterns were matched. It means that "react-native run-android" command failed.
Please, check the View -> Toggle Output -> React Native, View ->
Toggle Output -> React Native: Run android output windows.
So, below is output from React Native: Run Android:
[Warning] Target simulator is not supported for Android platform. If you want to use particular device or simulator for launching Android
app, please specify device id (as in 'adb devices' output)
instead. [Info] local.properties file doesn't exist. Using
Android SDK location from PATH. [Info] Starting React Native
Packager. [Info] Attaching to running React Native
packager Scanning folders for symlinks in
e:\Software\Android\VSCodeReactDebug3\node_modules (20ms) Could not
find device with the id: "simulator". Choose one of the
following: [ 'emulator-5554' ]
I searched forums for the greater wisdom and saw a few posts related to this erratic behavior but those, while sharing good troubleshooting clues, did not solve my problem:
https://github.com/Microsoft/vscode-react-native/issues/624
My project is very simple, almost empty few liners. So, very likely the problem is with my environment, but I cannot find anything that could explain it. I do not recall assigning ID “simulator” to anything. And do not know where it is controlled.
Any ideas are greatly appreciated.
Update.
Today I came across of post React Native debug with Visual Studio Code not working
and attempted uninstalling react-native package and installing react-native-cli. I literally ran following commands in that sequence to use create-react-native-app:
npm install react-native --global
npm uninstall -g react-native
npm install -g react-native-cli
So, now the IDE debugs and stops on breakpoints as before.
I am yet to learn what happened and why my other project suddenly stopped being debugged. I, perhaps, broke my environment attempting to recover from some other problem.
And I still cannot explain the error related to "Could not find device with the id: "simulator"" in the Debug output.
I'm trying to profile a game on real android device.
After I build and run it (with dev build, auto connect profiler and script debugging enabled) and setting android player instead of Editor in profiler/console options I can see that profiler window is working perfectly, but my console is not showing logs. (It did once (3 logs) but I cannot make it show logs again.)
Any suggestions of how I can make unity console show mobile logs?
You can create new text document using notepad and insert the following text below and save it as .bat file:
Your Drive:
cd location of the android sdk
adb logcat -s Unity ActivityManager PackageManager dalvikvm DEBUG
so for example in my case it's:
D:
cd AndroidSDK\sdk\platform-tools
adb logcat -s Unity ActivityManager PackageManager dalvikvm DEBUG
from here you can see all the debug logs that comes from Unity
My app crashes on startup when using AVD, but I cannot see debug output.
Debug output is in the Android tab. Anyway you can use adb logcat.
You should watch adb logcat. It is below in Android Studio. When you get the error, don't press OK. You should open android studio and adb logcat. You can see the error what is it.