How to test Windows Phone app upgrades

Properly testing app upgrades on Windows Phone is not as straightforward as it could be. When you deploy a XAP from the IDE or with the XapDeploy tool the build system will evaluate whether an incremental update is possible or if a full redeploy is required.  A full redeploy will remove all of the app’s IsolatedStorage and make testing upgrades impossible unless we use the ISETool. Continue reading

Posted in Annoyances, Development, Testing, Uncategorized, Windows Phone | Tagged , , | Leave a comment

Could not initialize OpenglES emulation, using software renderer.

I needed to launch one of my Android emulators from the terminal recently and I was surprised to see how slow it was, especially seeing as I had enabled host GPU acceleration and that the emulator an x86 one with HAXM enabled.  I had never experienced any such issues when starting the same emulator from my IDE.  The exact error that I received was this:

emulator: ERROR: Could not load OpenGLES emulation library: dlopen(libOpenglRender.dylib, 1): image not found
emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.

I had a suspicion that this library may have been lurking in the SDK somewhere so I had a peek and discovered where it was hiding.

$ find $ANDROID_HOME -name 'libOpenglRender.dylib' 
/Applications/Android Studio.app/sdk/tools/lib/libOpenglRender.dylib

The solution was to append the SDK’s lib path to OS X’s LD_LIBRARY_PATH before invoking the emulator.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ANDROID_HOME/tools/lib

Naturally you can put this line in your shell’s startup script and you won’t have to worry about this problem again.

Posted in Android, Annoyances, Development | Tagged , , , | Leave a comment

The curious case of the Gradle wrapper and source control

I was setting up a Gradle-based Android project on Jenkins today.  I had read in a few places that Gradle would be downloaded somehow after installing the corresponding plugin but the build was failing within seconds of starting.  My SDK was fully up to date and I had already set ANDROID_HOME but the build was still complaining about not being able to find gradlew.  

When I read the manual I discovered that gradlew, gradlew.bat (for our Windows friends) and the gradle/ directory in the project’s root are supposed to be committed to source control.  The next build went beautifully smoothy!

Posted in Uncategorized | Tagged , , , | Leave a comment

Error: Failed to initialize client proxy: could not connect to .

I was greeted with this error today when I tried to run some tests on a Windows Phone project.  To cut a long story short my test project’s configuration had somehow lost its Startup object, as you can see in this screenshot. 

Screen Shot 2014-01-06 at 17.20.11

The remedy was simply to change the startup object to the relevant Xap.  After this the tests started to run again.

Posted in Development, Windows Phone | Tagged | 1 Comment

Wrong text colours with Holo light theme and dark Action Bar when using spinner navigation

I battled with this issue this evening for a couple of hours. I found myself having to go to extraordinary lengths for something that I thought should have “just worked”.  I think an image best illustrates the issue (and not the ridiculous title of the article!)

Screen Shot 2013-12-26 at 20.38.45

As you can see the dark text on a dark background is very difficult to see and is definitely wrong.  This is a known issue and isn’t helped by poor documentation for the Action Bar which shows the wrong way to do things.  The solution is rather simple and it is that you should use getThemedContext() when you create the SpinnerAdapter that controls the drop-down navigation.

The wrong way

SpinnerAdapter navigationSpinnerAdapter = 
ArrayAdapter.createFromResource(
  this, R.array.lineNamesArray, 
  android.R.layout.simple_spinner_dropdown_item);

The correct way

SpinnerAdapter navigationSpinnerAdapter = 
ArrayAdapter.createFromResource(
    getActionBar().getThemedContext(), 
    R.array.lineNamesArray, 
    android.R.layout.simple_spinner_dropdown_item);

When you use the correct context you should end up with something like this:

Screen Shot 2013-12-26 at 20.54.27

Posted in Android, Annoyances, Development | 1 Comment

Port 8888 blocked when you restart Windows

This is an interesting one.  I’m doing some Windows Phone development at the moment and I usually run a debugging proxy on my local machine on port 8888.

After a routine reboot my proxy wouldn’t start up because port 8888 was already in use.  I did a “netstat -b -a” to find out what process had taken the port and saw that it was “IpOverUsbSvc.exe”.  After a quick search I found that this process is related to connectivity to a Windows Phone device.

After unplugging my phone from USB the port was freed up and the proxy started immediately.  The lesson here is to either change the port your proxy uses or to plug out your phone when you restart.

Posted in Windows Phone | Leave a comment

Linkifying a TextView after setting text

Just a quick one.  You probably already know that you can automatically convert URLs in a TextView into clickable links like this:

mTextView.setAutoLinkMask(Linkify.WEB_URLS);

I recently learned that this will only work where you can call setAutoLinkMask() before setting text in the TextView.  The simple solution is to set the text after calling setAutoLinkMask(), but if you cannot do this, as in my case, then you can just as simply use the static addLinks() method in the Linkify class:

 Linkify.addLinks(mTextView, Linkify.WEB_URLS);
Posted in Android, Android snippets, Annoyances, Development | Leave a comment