Tag Archives: DDMS

Android Debugging Protip & Mini Upload Update

I’ll start off with a very useful tip if you’re doing any Android development: use ddms and logcat!!! I heard this several times at Google I/O and even attended a talk about it, however, my work computer’s Eclipse doesn’t seem to want to let me use the DDMS perspective. Daniel’s works fine, and I found a work-around (close eclipse w/ emulator running, run ddms from terminal).

The DDMS tool allows you to view the phone’s (or emulator’s) file system, browse logs, and many other things. I find the logging aspect particularly useful though; not only can you browse for any messages where the OS thinks something is happening, you can actually insert your own debugging statements. You start to miss System.out.println pretty early on in Android development, because variable visibility in Eclipse’s debug mode is a little hokey (for some pretty complex reasons which are beyond me). However, the solution is of the form: Log.e(“MediaPlayer”,”Hey! I’m writing a statement out to Logcat at this point in the code!”);

I’m pretty sure MediaPlayer can be whatever you want too, but the snippet I found had that in it, and I haven’t tried to change it. (All it does is categorize the log messages)

As for my mini-update with the Upload code, it works again!!! The issue was with the file system, as I suspected. I’ve fixed the stupid things I did to it, and all is well. I can upload from emulator to octopussy flawlessly, but real phone to octopussy is still a no-go. I think it may have to do with internet permissions on the phone, but I’m still testing. I hope to blog some success on that front either later today or Monday!

Uploading Files from Android (progress update 2)

Right before I left the lab yesterday, I uploaded from the Android Emulator to Octopussy successfully. Daniel was here, he’s my witness.

Today, it doesn’t work, which is super awesome. It isn’t a matter of computer goblins or anything like that though, the Android Emulator was running a pseudo-SD card which I had manually pushed my test file onto. That is the only thing that changed from yesterday to today, so something has gone wrong with the file system. I’ve been making some attempts to get away from using the SD cards for my testing, because it is a bit unpredictable.

I wrote some code to generate files based on user input, but I’m getting the same crashes from that as I do from the SDcard version. I have a feeling it has something to do with file permissions, because when I browse the emulator’s file system with DDMS, the permissions on files I’ve pushed are all weird and different from other ones on the phone. I started having some issues yesterday with command line sdcard management, and I switched to direct code/DDMS options, which is probably why it is acting all weird.

Once again I’m really hoping I can get it up and running soon! It was really exciting to see it run successfully yesterday, and pretty disappointing to have it crash today 🙁