I have an app that works as intended when run on API 8, but when I run it on any older API version, it crashes with:
10-28 12:10:50.755: ERROR/AndroidRuntime(1864): Uncaught handler: thread main exiting due to uncaught exception
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nw.caremeter/com.nw.caremeter.CareMeter}: android.view.InflateException: Binary XML file line #35: Error inflating class <unknown>
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2596)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2621)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.app.ActivityThread.access$2200(ActivityThread.java:126)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1932)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.os.Handler.dispatchMessage(Handler.java:99)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.os.Looper.loop(Looper.java:123)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.app.ActivityThread.main(ActivityThread.java:4595)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at java.lang.reflect.Method.invokeNative(Native Method)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at java.lang.reflect.Method.invoke(Method.java:521)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at dalvik.system.NativeStart.main(Native Method)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): Caused by: android.view.InflateException: Binary XML file line #35: Error inflating class <unknown>
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.app.Activity.setContentView(Activity.java:1629)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at com.nw.caremeter.onCreate(CareMeter.java:48)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2544)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): ... 11 more
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): Caused by: java.lang.reflect.InvocationTargetException
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.widget.ImageView.<init>(ImageView.java:105)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at java.lang.reflect.Constructor.constructNative(Native Method)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): ... 22 more
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/needle_green.xml from drawable resource ID #0x7f020005
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.content.res.Resources.loadDrawable(Resources.java:1693)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.widget.ImageView.<init>(ImageView.java:115)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): ... 26 more
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): Caused by: java.lang.NullPointerException
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.graphics.drawable.RotateDrawable.inflate(RotateDrawable.java:207)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:788)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:729)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): at android.content.res.Resources.loadDrawable(Resources.java:1690)
10-28 12:10:50.765: ERROR/AndroidRuntime(1864): ... 28 more
What reasons might there be for this failing on API7? My drawable resources are in res/drawable (I've tried making copies in /drawable, and the problem persists regardless of drawable-{hdpi,ldpi} folders). For the sake of completeness, needle_green.xml:
<?xml version="1.0" encoding="UTF-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="90"
android:toDegrees="90"
android:pivotY="125"
android:drawable="@drawable/needle_base_green" />
And needle_base_green:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke android:width="2dp"
android:color="#00ff00" />
</shape>
This is pretty much a first android app, so it's likely something shockingly trivial. Thanks for any help.