Testing android app on real Device

Today I got the Samsung Galaxy Note 10” tablet and can’t wait to install my uncompleted app on it.

First, I need to install USB driver for the tablet. When I plugged it in, it shows fail to find the android usb driver for ADB(Android Debug Bridge). At this time, my Eclipse can’t find the device, and neither abc. when I call “abc devices” command line, it shows no attached device.  For samsung tablet, I went to samsung website to install ADB driver. it turns out I have to install Kies from Samsung and this will install ADB driver for me. I couldn’t find independent ADB driver. Now, “adb devices” on command line will show a device connected. the number shown doesn’t make sense though. Note: on command line, first need to go to the folder of android-sdk/platform-tools/, then call adb devices.

Then, I turn the debugging mode on by Developer options->USB debugging mode

Now, in Eclipse, I run my application as usual, only to set “Run configuration”->Target->Launch on all compatible devices/avd->active devices.

Now the app is installed to the tablet.  As long as the cable is connected between the tablet and the computer, I can compile and run the app on tablet which is faster than when running on emulator. awesome!

However, I had an issue in this whole afternoon and evening. I keep running into “null pointer” error when I click on some of  elements in the questionnaire, or when I try to open an activity( in my case, questionnaire activity). and I thought maybe it’s because Samsung use different library . so I changed some elements name, or changed the way of implementing the style of spinner (set android:entries=”@array/**” instead dynamically customize it in onCreate(). all the errors are still there. they are all caused by findViewById() can’t find the element. and I couldn’t find a pattern for what elements may go wrong.  At first, i thought maybe it’s because I set some element to be android:visibility=”gone” in the xml file, and findViewById() can’t find it under Samsung library or what.

Guess what, it’s all because I created layout files of QuestionnaireActivity for different densities, but I didn’t update the version for xhdpi. I only update for mdpi (layout folder without any prefix).  But this tablet is xhdpi. thus, it is using the old layout file that doesn’t have all the elements.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s