how to work on android mobile logcat - android

if its possible to see what type of run time exception in android mobile? because i developed one application which works fine in emulator but stop working in mobile.. is there any Log-cat..
[a Log-cat]: https://play.google.com/store/apps/details?id=org.jtb.alogcat&hl=en doesn't shows errors..! i cant find any tutorials for "a Log-cat" apk.. please help me!! Thanks in adavance

You will find a lot of applications to read the Log of your installed Apps, but they require root permissions to display the exceptions.

If you have the sdk tools installed you have access to the log cat from that if you run your apk while connected to the computer. If you use eclipse there is even a guy with easy access to it, otherwise there are command line tools.
In essence, plug it into your computer and you can get to the logs.

I would recommend you work through:
https://developer.android.com/training/basics/firstapp/index.html?hl=cn
As it will get you set up and teach you to use the tools. If you don't want to do that:
Command Line:
http://developer.android.com/tools/help/logcat.html
Eclipse:
How to enable LogCat/Console in Eclipse for Android?
How to debug on a real device (using Eclipse/ADT)
IntelliJ
https://www.jetbrains.com/idea/webhelp/debugging-with-logcat.html
Short: Either root and use an application to view the log cat, or plug it into your computer.

you can try this code to view it
try{
//do something
}catch(Exception e){
Toast.makeText(context,e.message(),Toast.LENGTH_LONG).show();
//or you can start a new ACTIVITY and put STACKTRACE in a TextView
}
But this have a drawback that you should know that in which part of you app the Exception may occur.
I have tried it using a Toast. Hope it helps.

Related

How to find the reason my app stopped without Android Studio

I just finished my last app and after intensive testing on android studio no bugs or errors pooped up.
But when I use my phone for some time and try to check my app it crashes, and error pops up.
Is there a way to find out the stack trace od that error? specially since its not connected to my PC.
You can integrate tools for analyse, like:
Crashlytics
So you have a dashboard and can setting a e-mail for warning.
You can use different options:
Store logcat file in Internal memory as txt file. This will be best solution since it will provide all the necessary information of pre-conditons for the crash
Implement crashanalytics like Hockeyapp
Use remote debugging. Refer this official document for more info
You can find more details for approach 1 & 2 at: remote logcat - Android Studio

What ruboto debugging tool should I use?

I am trying to leverage my very modest Ruby experience with Ruboto. I have installed the necessary packages, and the various demos work well on the simulator (on Windows) and on my Android device. I have been able to write some very simple Ruby scripts for Ruboto, but when they don't work, I have no visibility over what is happening. The only error message I get is: "Unfortunately, xyz has stopped."
I assume there must be a way to troubleshoot a Ruboto script and get a log or some kind of detailed information on the reaction of the system to each line of code.
I have been googling that question for a while without success, and I apologize if I missed something obvious. I also tried "adb catlog" without getting any useful information related to the Ruby script, but maybe I was not able to find the right information in the thousands of line generated by this command.
I hope someone can point me in the right direction.
Thanks
At the moment, the debugging options for Ruboto are limited and low-tech.
You can analyse the log using "adb logcat" or the newer "rake log". "rake log" uses "adb logcat" but applies a filter so you get much less noise. If your app crashes, you should see a Ruby stack trace with the immediate cause of the crash. This is probably what most Ruboto developers use now.
Another option is to encapsulate a risky method with a "rescue" that either logs a better message, or displays the error in a dialog. This would probably be more helpful, but requires a bit more work. You could request this as a Ruboto feature in the Ruboto issue tracker :)
Would something like "debugger" work here?
It would be awesome if it could...

Corona SDK - APP Doesnt work on Android

Someone could help me, I made a game in Corona and works perfectly on the simulator, but when I install the Android does not work, the functions are not called. Follow the project https://github.com/AndreRavagnani/SamuraiTheRevenge
Thanks
Make sure you aren't requiring anything in your main.lua file. Also what I would recommend doing is using ADB logcat to see what error is happening on the device. Most likely it's a syntax error that only occurs on build. Plug your android device into your computer and run logcat to see what happens.
If it works on the simulator but not working on your device, then these could be the few possible errors.
Check the file names are proper, because corona is case sensitive, simulator wont care about the spellings but device will throw error.
Check whether you are giving the proper scene name, this also case sensitive.
Check whether you are giving the proper file path .
I hope if you check these things it will give you some solution.

Where is standard output for android development on Netbeans?

I am developing an android app on netbeans. If, for example, I were to add System.out.println("Hello World") attached to a button click, it does not output anywhere. Am I missing something basic?
This also means I can never see if exceptions are being thrown or anything. If my app works it works and if not I am developing 'blind'. Help?
On Android all of those go to the on device logcat. Not sure how you'd see that with netbeans, but you'd need to hook it up to adb logcat in some fashion.

Best way to debug exception

any best way to debug exception unless using logcat since the overall code are very big? do u think using break point to view the value if installing apk into actual android phone and running it on the phone via usb cable?
do u think using break point to view the value if installing apk into actual android phone
If this means, 'can you debug using breakpoints on the actual phone?'. The answer is Yes
Here is a tutorial you can follow
The size of the codebase is mostly irrelevant when trying to find the cause of an exception (It might complicate things a little, but in general the procedure is the same as debugging a small application). Debugging is the most efficient way of finding bugs, because you're running directly inside your application and you will not have to speculate about the current state of your application (you can actually look at it).
I suggest that you...
Get familiar with Eclipse debugging
Read the stacktrace
Try to find the exact line in the code where the exception happened (according to the stacktrace)
Set a breakpoint at the exact line or at the beginning of the method
Restart you application and wait until you hit the breakpoint
Inspect the variables using the tools in Eclipse
Hope that helps.

Categories

Resources