Search code examples
androidcordovanine-patch

Android Exception loading 9-patch image


I'm trying to implement a 9-patch splash screen for PhoneGap Android and I keep getting compiler exceptions.

I have a res/drawables/splash.xml containing:

<nine-patch xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/splashimg" 
android:dither="false"/>

I have splashimg.9.png saved to res/drawable. (Using a test 9-patch image as taken from Android splash screen image sizes to fit all devices)

And I have the following in my DroidGap file:

super.setIntegerProperty("splashscreen", R.drawable.splash);

When I try to build, however, I get:

org.xmlpull.v1.XmlPullParserException: Binary XML file line #1: <nine-patch> requires a valid 9-patch source image

Any ideas? I can get a normal splash screen working, just not a 9-patch...


Solution

  • Found the problem. I only had the XML and 9.png file in the res/drawable directory. As soon as I placed them into the other four directories, everything started working fine.