Ive developed some app for Android,
the Weirdthing that on the emulator it's pretty stable, but when i tryied on real device of a friend(nexus), it crushes times to times, cant finger on a specific case when exaclly it happens.
i realy want to distribute the app asap, but i cant find any leaks in my emulator.. what I should do? how can i debug my app and find the reasons for it to get crush on real device..
Thanks,
Idan
Plug the Nexus One into your PC, and view the stack trace when the app crashes. If you want to know why your app is crashing you've got to get to those stack traces.
You can tell your friend to download http://code.google.com/p/android-log-collector/ from the Android market and run it right after a crash. It'll give him an option to share his recent logcat in various ways.
Some things may be private to him (like what programs he has ran) so he can email it to himself and forward you just the parts about your app.
Related
I've been working with PhoneGap for about two weeks now, yesterday I've build a new android app all went well except that the app starts very slow on my android device. It first shows me for three seconds just a black background except the navbar. So I want to ask how to boost it up or which files I could remove or what I've done wrong please I would be happy if you explain me also the file structure. Thanks in forward for your answers!
Your question is little bit vague. Please, give us more information about your app, about your config and what you’ve already tried.
If my app is slow on any device, I do generally the following:
Check if the same problem occurs in the browser
What’s going on at the start of the app in the browser (Chrome Dev Tools)
If nothing unusual happens, check the logs on the device
For Android, I’m using Logcat for checking what’s happening on the phone.
In order to use Logcat:
1.) Enable debugging mode on your Android phone
2.) You need Android Studio
3.) Connect your phone to your computer and start Logcat in Android Studio 3.1.2
4.) Check the logs while you are starting your app on the phone
It is not really a programming question. I have this app that continues to crash on my phone, but works fine for everybody else. I used to program android apps, so I have knowledge in this field.
It something on my phone probably it always crashes at the same stage. I did not program this app. How can I still get the details of the error or the trace of the exception?
I would suggest plugging the phone into your computer or laptop, opening up the Logcat tab in Android Studio and viewing the exception details as the app crashes.
This can be done separately from Android Studio using ADB but it involves more steps.
Of course, make sure that you have enabled USB debugging on your device before this.
I was wondering if there is any way to get any feedback of what's going on behind the scenes when running an app on an Android device. If I use the emulator and eclipse I can see what's happening in the logcat. But I'm making a program with ROS android and it I cannot run it on the emulator. Now my program crashes and I don't know why. Is there any way I can get more information?
Thanks
You can use adb to debug the app on your device. See http://developer.android.com/guide/developing/device.html
I can think of a couple (less than elegant) ways to try and find out what's going on.
1) Display toasts from potential problem areas (Does it have a screen?)
2) Write logs to the SD card (does it have an SD card??)
EDIT
I wasn't thinking clearly... you have to be able to load the program to the device, so you must be able to connect it to your PC. So, as Agarwal pointed out, you can most likely hook it up, run it on the device/robot/whatever and see what happens with the logcat.
How can i debug when application works without error in emulator but force closes while doing SQLite operations on some screens?
Connect your phone to your dev machine
Make sure the emulator is not running
Open a command prompt and run adb logcat
Use application on your phone and trigger the error
Review the resulting stack trace in the logcat output
You can also view the logcat output in Eclipse via the debug or DDMS perspective.
You should connect the phone to your development machine and look at Logcat (or use the debugger) to see what is going on in the stack trace. You can also install an app (like CatLog) on the phone to view the log.
You just connect you phone and use debugger. When it is open just choose your phone...you can use and logcat too...
Everyone else commented about the technical tools available, so I'll try to explain the process we have with our app. Our app is pretty widely used, so we have a bunch of different devices to consider.
Create a beta group. There are a lot of devices, and it's impossible to test on all of them yourself unless your company has very deep pockets and you have a lot of time to test. Get a group of users together who are ok with things breaking, and ask them to beta test.
Look at what's different. This one seems obvious, but it's surprising how often this trips us up. If an app isn't working on certain devices, what's different about those devices? We once had a bug that only occurred when the app was in landscape mode, so we saw it mostly on devices that default to landscape mode. When you're trying to find the cause of a bug, ask yourself what the difference is between the scenario where the app doesn't work and the scenario where the app does work.
Use the tech available. Sometimes, the last two don't catch all the problems. Sometimes, you get a weird edge case. We had 2.3 devices that didn't implement a deprecated method-- even though the method was deprecated in 3.0. For whatever reason, they didn't implement the method and left us without its replacement, so we had to use a backwards compatibility package. But the only reason this came to light was because we got access to the logcat reports from users who experienced the bug. Moral of the story: manufacturers do weird stuff.
You're not going to be able to catch everything. There are just too many subtle and non-sensical differences. But (especially with beta testing) you should be able to catch 99.99% of the problems before they happen.
I use IntelliJ IDEA to write Android apps, and use the DDMS Windows application to view the Android logs (separate from the IDE). It works fine, but after a seemingly random period of time, the logs vanish, except for one line of log, which gets overwritten with incoming logs. I have to shut it down and restart it, which combined with the delays of deploying an app to a device over ADB to debug and test is pretty tiresome.
Is this a known issue with DDMS? Is there anything I can do to make it work consistently without breaking itself?
Are there any other Android log viewing applications for Windows that work better? I'm not very fond of the IntelliJ IDEA one. My favourite is actually CatLog on Android itself, but on a small-screen device it's not a great experience.
It's not about the time, but number of lines being recorded. As Dave C said in the comment, just clear the log and it will be fine
Have you tried looking at "Why doesn't LogCat show anything in my Android?"? The top voted answer may solve your problem