How to configure the log cat when developing for flutter - android-studio

When flutter has an error, the stacktrace is printed in the console however for subsequent errors I only get:
Another exception was thrown: short description of my error
Is there a way to configure android studio to display every error in its entirety with a full stack trace? Thanks

Well, https://flutter.io/docs/resources/bug-reports explains how to modify flutter to use Verbose mode in producing logs and where to locate them. According to the flutter website:
All Flutter commands accept the --verbose flag. If attached to the
issue, the output from this command may aid in diagnosing the issue.
The explanation was done using xcode, but it should not be a concern since since Flutter configuration are independent from IDEs'.

When that happens, it means that the error is exactly like the one before. There's no need to see it again, as it would just clutter the logs.
If flutter showed you all of the errors everytime, there's a high chance your output log would be big, incomprehensible, and impractical to use, specially because sometimes if you just touch something, move something, rebuild a screen, some errors can happen multiple times.
So I don't see that as something necessary, much less advisable.

Related

AdroidStudio 2.2.2 Empty Activity Error on phone

I just started learning about Android development, so this one is a serious issue for me: I launch Android Studio (2.2.2, but had the issue since 2.2.1) on Win10, make a New project, just keep clicking Next without changing anything (selecting Empty Activity as the template), Finish, try to Run 'app' on my phone and consistently get this error:
Error while executing: am start -n "com.example.android.myapplication/com.example.android.myapplication.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.android.myapplication/.MainActivity }
Error type 3
Error: Activity class {com.example.android.myapplication/com.example.android.myapplication.MainActivity} does not exist.
Error while Launching activity
Being a complete newbie who was just supposed to change some text in XML and run the app on a phone, I have no idea what to do or edit to make a pregenerated app actually work. I searched StackOverflow for a more general approach to these errors and tried:
Restarting AS/computer
Disabling InstantRun
Messing with Clean/Rebuild/Synchronize/Sync with Gradle
Deleting .gradle and .idea folders and Syncing with Gradle
Some other obscure shenanigans with build.gradle and AndroidManifest
Various combinations of the above.
... None of which worked (or affected the problem in any way, in fact).
Other observations:
The app isn't even installed (checked All apps, there isn't any com.example.android.myapplication or MyApplication app on my device)
On the development course forum, it was suggested that com.example.android.myapplication/com.example.android.myapplication.MainActivity should only read com.example.android.myapplication/MainActivity. So far I haven't been able to figure out how to change that.
Update 1 New attempted fixes (neither of which worked):
Specified activity directy in Run/Debug window.
Specified no activity whatsoever (doesn't show that error, but doesn't run anything either).
Did File/Invalidate Caches
Changed android.intent.category.MAIN to all-lowercase and back.
Added "category android:name="android.intent.category.DEFAULT"/" to Manifest
Update 2 Managed to run the app on emulator. It seems to be working there, so the error will likely be somewhere between AS and the phone (Android 5.1.1, API 22).
Developer options and USB debugging are on (confirmed the pop-up message, too)
Driver is up to date (AS can see the phone without problem)
Phone is on (and not asleep) while I'm trying to run the app
Any suggestions why the phone won't download and run the app?
In your manifest file edit
with android:name="com.example.android.myapplication.MainActivity"
Make sure that your code doesn't mean any nonsense and that it wouldn't cause the app to crash, which is sometimes the problem. Try finding a problem in code which could crash the app. Maybe in your crash log you can find what causes the crash. Good luck fixing that.
According with your error log I suppose you did not delete previously installed app. See my accepted answer on the same question for details.

Getting detailed crash dumps from a hooked exe

I am trying find a problem with my program that is hooking into a game. This is
vc++. Basically I launch the program and then hook into it using SDL. When I run the code from VS2010, all works fine. But when I try to run from command prompt, my program can launch the game, but after that the game crashes immediately.
I was viewing windows event logs, and it appears that there is an access violation. 0xc000005
How can I log any further details about the program that crashes? I tried "procdump" but that is not useful as I cannot INDIRECTLY target the hooked game from console. Rather it can only target my application that hooks.
Anyway of getting detailed dumps is highly appreciated in this case.
Thanks!
You can perform postmortem debugging by using a combination of the WER registry keys/values to trap any dump that is produced. I’ve used this method to prevent the WER system from collecting the dump file (.dmp). I’ve also written about this in another similar post. To accomplish this, you will need to create a registry key under
Software\Microsoft\Windows\Windows Error Reporting
if one does not already exist. The key should be
LocalDumps\your application.exe
Once that’s done, modify these keys/values to meet your needs:
DumpCount, DumpFolder, DumpType
You’ll need Administrator rights to create and modify the keys, and, you should reset everything you’ve modified when you’re done debugging.

How to see MSBuild output generated in project load time?

I've noticed that when Visual Studio 2012 loads/initializes projects (when opening a solution or when changing platforms/configurations), it may execute some MSBuild targets - those that are listed as InitialTargets (it doesn't always do that - sometimes it waits until you actually build it; I can't figure out when exactly, but that's a different question).
Anyway, these targets may generate some output in the form of MSBuild messages. If the targets were being run as part of a build, these messages would go to the output window of Visual Studio (and perhaps a log file). These "load-time targets", though, do not seem to send their output to the output window.
How can I see or log the output of MSBuild targets which execute outside of build time, and specifically in initialization time?
The best information source from the MSBuild team at Microsoft I could find is dated (2005), but may still be actual if no one could come up with fresher information:
The project load logger is used when projects are opened. It discards all messages logged while the project is opened, puts warnings in the error list, and displays any errors in a message box to the user. The errors displayed are quite detailed and useful in helping diagnose project file formatting issues.

Windows 2008 R2 No Crash Dumps

I've been searching for a while and finding many old articles but also found one with a Regedit to enable the dumping of .dmp files, which isn't doing it.
Instructions I used are from Microsoft, Collecting User-Mode Dumps (MSDN)
According to Symantec no re-boot is required.
I created it for both:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\Windows Error Reporting\LocalDumps and HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps.
All I get is a report.wer file. No dump. The event log is writing exceptions about every minute and about every 30 minutes the app pool dies, so I'm trying to get the details on where the problem is coming from.
Anyone know why those keys aren't working? Does the report.wer provide anything useful for me? One StackOverflow post said SOS extension and when I search for it Microsoft points me to download WinDbg which I already installed. A lot of instructions I find from 2008 and older seem out-dated.
Edit: I managed to get dump files by running the debugging tool on the server. But there's so much wrong information out there on how to get the actual code info that none of it is working.
I've tried adding the symbols path to my pdb files and I've tried
.loadby sos clr
.loadby sos
!CLRStack
!analyze -v
and all I get is wrong symbols.
WER won't catch crash dumps if there is no crash at all. You know that a process can exit normally, when you think it crashes.
If you do want to learn why a process exits (normally or abnormally), the most reliable way I can think of is to utilize Debug Diag (which is built specifically for IIS),
http://msdn.microsoft.com/en-us/library/ff420662.aspx
Note that you probably should use Debug Diag 2.0 at this moment, and must add Kernel32!ExitProcess and Kernel32!TerminateProcess as breakpoints.

Why is Exception StackTrace null in MonoTouch 4 running on device?

I've just updated to MT 4.0.1 from 3.2.6. Now it seems that exception reports no longer contain stack traces when running on the device.
I have an exception handler attached to AppDomain.CurrentDomain.UnhandledException that I use to save an exception report to a file. On the simulator in both Debug & Release modes, UnhandledExceptionEventArgs.ExceptionObject.StackTrace is set. On the device in both Debug & Release modes that property is null.
I have tried checking "Emit debugging information" in the "Compiler" section of the project options. I have tried adding "--nosymbolstrip" to the MT build args. I have tried LLVM both enabled and disabled.
Any ideas? We will not be able to update in the App Store until we're confident that any exception reports we receive contain the necessary diagnostic info.
What information does ExceptionObject.ToString() provide? It should include the error message and stack trace. I know this has been working for me, b/c I recently used it to submit a bug to Novell.
Also, you might want to wrap a try-catch around your app startup in static void Main(), as AppDomain.UnhandledException is meant to be used for off-thread exceptions.
This would seem to be fixed in MonoTouch 4.0.4.1, though I didn't see that mentioned in the update description. Perhaps someone from Xamarin can confirm it was fixed on purpose.
For the record, it was stack traces in general that were broken on device, not just those associated with an exception. Formerly if you did new StackTrace() then its frames would be incomplete.

Resources