Is there a way of receiving traces and errors in the output panel just like from the flash target?
You can use logcat in order to get the game/app log. That will include all the trace() and Log.I() calls you added in the code
Logcat - Android developers page
Logcat is located in your Android SDK folder. You just need to run it and you will start to see all the output from your device. In the page I attached above you have some cool commands to copy the log to a file and clear the logcat output. I combined both in a script and I run it every time I compile to Android. It’s not like adding breakpoints in the code, but it helps a lot. Hope it helps.
Cheers,
- Frano
Thanks Frano,
could you give me an example of how you run the commands every time you compile to android?
Did you put that into the Post-Build Command Line in FlashDevelop?
It deppends a lot the application you are creating. But you will save a lot of time if you debug as much as you can in a faster compiling platform (for example HTML5)… Of course you will need to compile and test from time to time on Android… But it will save you a lot of time from “stupid bugs”
Regards
Luis
I also use Neko and desktop C++ as testing targets. Neko builds quickly, native builds tend to go pretty quickly (certainly faster than Android) after the first time through, but HTML5 works as well
cd C:\android\sdk\platform-tools #goes to the adb folder
adb logcat -c #clears the logcat output
adb logcat > yourfiledestination.txt #start collecting the device’s output and saves it in a desired txt file
Those lines should be in a .bat file. Run the .bat everytime you build the game for android. You can open the .bat in the post-build command line as well, but I don’t know how to do it
Good luck!
Usually I´m testing on neko and stuff, but it´s difficult for multitouch testing.
I thought Project → Properties → Build → adding “android-debug-log.bat” would do it.
But it seems that hinders the completion of the build?!
DIdn´t work for neko and didn´t work for android
Thanks for the info. I can check later what could be happening there. But try running the script by your own for now and should work fine.
Another thing I do is a .html file which loads the result .txt file so I can update it pressing F5 in order to see the logs.
You can use lime trace android
to get trace messages, -debug
shows more and -verbose
shows all logcat output. We run the trace
step automatically when you do openfl test android
, but you can run it by itself in a separate console window if you like
@singmajesty : you mean that should already work out-of-the-box in Flashdevelop and show everything in the output panel?
Not sure if I got that right …
I believe regular “Android” in FlashDevelop should show trace output, if you add “-verbose” to the target drop-down, then it will show all ADB output, not just trace messages, or do a debug build and it should show more data (though it tries to keep it all related to your application)
For me there´s nothing showing up in android debug mode on FD´s output window
Here my log:
[echo] Debug Package: E:\__PROJEKTE_GAMES_APPS\_OPENFL_EXAMPLES\bunnymark\Export\android\bin\bin\BunnyMarkYo-debug.apk
[propertyfile] Creating new property file: E:\__PROJEKTE_GAMES_APPS\_OPENFL_EXAMPLES\bunnymark\Export\android\bin\bin\build.prop
[propertyfile] Updating property file: E:\__PROJEKTE_GAMES_APPS\_OPENFL_EXAMPLES\bunnymark\Export\android\bin\bin\build.prop
[propertyfile] Updating property file: E:\__PROJEKTE_GAMES_APPS\_OPENFL_EXAMPLES\bunnymark\Export\android\bin\bin\build.prop
[propertyfile] Updating property file: E:\__PROJEKTE_GAMES_APPS\_OPENFL_EXAMPLES\bunnymark\Export\android\bin\bin\build.prop
-post-build:
debug:
BUILD SUCCESSFUL
Total time: 26 seconds
Build succeeded
Done(0)
haxelib run lime run "project.xml" android -debug
Running process: C:\HaxeToolkit\haxe\haxelib.exe run lime run "project.xml" android -debug
/system/bin/sh: can't create C:UsersBOLKOAppDataLocalTemp/temp_3502311: No such file or directory
pkg: /data/local/tmp/BunnyMarkYo-debug.apk
Success
1916 KB/s (20576479 bytes in 10.482s)
Starting: Intent { act=android.intent.action.MAIN cmp=org.openfl.samples.bunnymark/.MainActivity }
Done(0)
Oh, FlashDevelop uses lime run
, not lime test
, try opening a new command prompt at the same directory as your project, then use either lime trace android
and use that for output, or just do lime test android
to build, run and trace in the same command
Ah ok thanks, is there a way to change the command in flashdevelop directly?