Android - Camera functionality howto - android

I'm using the example from the SDK (CameraPreview) and also the example from this site http://marakana.com/forums/android/android_examples/39.html
When I run it, both gives this error "The application AppName(appname) has stopped unexpectedly. Please try again".
I can't run the debugger either because it's always "Waiting for debugger. Force close". (I have debuggable=true in the manifest file)
The phone I have is a Nexus One.
Running on the emulator gives me the black and white squares with a moving square. (So I assume it works on the emulator?). Even on the emulator it gives me the "stopped unexpectedly" error 50% of the time.
Does anyone know what caused it?
Thanks,
Tee

Ok, my debugger decided to work again now.
Traced it down to this line. camera.setParameters(parameters);
That piece of code somehow killed the app.
Looks like you need to check it by getSupportedPictureSizes first before setting the parameter.(I have yet to try this part tho).

To see what the actual Exception is (plus it's path trace) you need to execute adb logcat.
To run the debugger, you simply wait 'till the "Waiting for debugger. Force close" dialog disappears.

Related

logcat show anything except errors

Look at above image I must take null point exception but I got nothing! not just in this case seems my android studio not show errors .
I try so many ways like restart adb,android studio,emulator of phone, clear cache, online sync, reset logcat and every thing I find, but still not working.
change your device phone or emulator and see what happened .
if work it mean your logcat phone is off and you must turned on it . in another cases i don't know but for Huawei following instruction will be turn on your logcat on:
1.Open your Dialer app and enter the following code: *#*#2846579#*#*
2.Enter the Background Settings page.
3.Click on “Log Settings”
4.enable your logcat on.
5.Reboot the phone.

Trouble and frustration with the Android debugger

So far I bought a half dozen Android books and yet couldn't find one that talks about debugging in a reasonable depth other than just scratching the surface.
I'm getting really frustrated about the fact that the debugger, when finds a problem, some times shows you the line in your code where the problem is happening and other times it just shows the "source not found" error in the class file editor. (I attached the screen-shot below).
When the debugger shows the line (in your code) where the execution stops it is clear to understand what's happening and easy to figure out what the problem is.
But when you get the "source not found" message it's really hard to figure where the problem is happening, don't even know where to start and I have to put breakpoints all over the place until I can reduce the area and pin point the problem.
Doing it that way is really... really... time consuming, what should I do when the "source not found" appears, where do I get a clue of the location of the problem? Is there some view or something else that I'm missing? How do you guys do it when that happens? Thanks in advance.
The line will always be printed in the logcat. Just hit run until it stops breaking, and check the logfile. It gives the complete stack trace there.
Ok, I'm going to be the geeezer jerk for a minute. A debugger is a crutch. Your first reaction as a programmer should always be to check the log file. The log file will generally give context, and you won't always be able to run a debugger (you're running on an interrupt, the code is running on a remote machine you don't have access to, the code is running a language that doesn't have exceptions, the crash is a hard crash and brings down the computer, etc). Checking the debugger should be step 3 or 4, not step 1.

Eclipse Android Debug Not Launching - No Errors, No Logs, Nothing

I couldn't find the answer to this on SO, so I thought I would submit a question/answer.
I'm not sure if this is version specific, so just in case it is I'm running Eclipse 3.7.2 and ADT 18.0.0.v201203301601-306762
Developing for ICS.
I spent a good portion of the morning running trying to debug my app. I would go up to the little green bug, and click on my project.
The Launch indicator starts at the bottom, fills all the way up to 100% then nothing. No errors, no log output, no logcat messages, nothing under console. For the most part, there is no output indication that something has gone wrong. It just doesn't launch.
I have been switching between and HTC device and an emulator for debugging - mostly using the device for tests right before a release.
So I thought I would plug the HTC in and try again. Plugged it in, logcat started rolling, clicked on the de-bug, same thing. No output, no logs, nothing. It just doesn't launch.
Answer.
I finally decided to (though this should have probably been one of the first things I did, however because there were no errors or log outputs, I thought this was something exotic.) check the debug configurations. Turns out that under the Target tab, the deployment mode somehow got switched to Automatic. However, I had recently deleted a virtual device. This lead to an Automatic launch, with no device selected for the launch. Thus, the launch was automated with no end point.
To me, it seems there should be some sort of error message for this sort of thing, something like, "You have not selected a device" or "Please select a device", which is why I immediately suspected a more serious issue - but hey, I'm just a developer.
At any rate, all I had to do, obviously, was to set it back to Manual and voila, she's a kickin' again.
Some may think this is a no brainer, while others more slightly crazy with a tendency to distort reality may end up having the same problem I did. So, in sympathy to the crazy/distorted reality type - here's the answer :)

Android emulator shows blank when debuging

I am building an app and have hit a bit of a bug when running my app. In order to troubleshoot this I tried debugging, rather than running. However, whenever I do this, the screen of the emulator shows all black apar from the app name bit at the top.
Anybody know why this might be?
For some reason, I can now see the layout, so thanks for your help. However, the "variables" eclipse window shows blank, and this is the bit I really want to see. But thanks for your help.
post your main activity code / androidmanifest xml code,
Restart your eclipse... it would Definitely show something in your logcat window since your application has started on emulator...

getting blank screen in logcat

I have got a problem in my logcat screen and the problem is that,whenever I get error from my application I get blank screen in logcat and I am unable to look at the errors and fix them.How do I overcome this sort of issue?
here is my logcat screen:
Update your ADT plugin in Eclipse and right now you are using deprecated Logcat.
Help > Check for Updates
Go to DDMS->Devices and select the device that you are currently working on.
Just Try this command:---
adb shell
echo 1 > /sys/kernel/logger/log_main/enable
I run into that problem sometimes and I suggest:
Make sure you select the "V" tag to prove that why this happened is not because there is really no errors (Since you select the "E" tag).
Install the USB driver from the manufacturer of your device. Although you can connect the phone to PC as an USB storage device without the driver, you can't debug on the phone without it.
In Settings->Applications->Development, check the USB debugging choice to allow you to debug on the phone.
Make sure you have selected the proper device or emulator, not some other emulators or devices.
Sometimes, the logcat shows nothing, even if you have finished these steps above. In this case, click the "Clear" tag(at the top right, with a RED cross), unplug the phone and plug in again.
you have 3 things to do..
start emulator...
then see devices select your avd like Windows-show view-other-android-devices...
then start logcat Windows-show view-other-android-logcat..that's it and it will do..
But First you should see the emulator in devices..
If you can't then in devices click down arrow near camera icon and click on reset adb.
I ran into this issue in the Android Debug Monitor today. The reason this happened to me was because I had set the "maximum number of logcat messages to buffer" under Preferences/Android/LogCat to some very large amount like 50000000000. If you have played with this setting try setting it lower to like 5000. Once I configured mine back down to 50000 I started seeing messages come through LogCat again. You may have to restart things like the Android Debug Monitor, adb, the computer, the emulator, or the phone. At one point or another I tried all of those. Also you should see an error message when you try to configure this setting back to default. I believe it was a Java Null pointer or something. You can safely ignore the message and just check that the configuration worked when you go back into the Debug monitor. Good luck!
Although this question has been asked long before, I am answering for others who might stumble upon this trouble.
In Mars, eclipse 4.5 and linux using GTK 3, if Android Logcat display is missing, add the following in eclipse.ini before --launcher.appendVmargs
--launcher.GTK_version
2
May also refer these posts.
Logcat show invisible messages in Eclipse Mars
Eclipse GUI broken

Categories

Resources