开发者

Android 1.5 w/ xml drawables

I am having an issue w/ a pretty basic login screen. It does have a view flipper and relative layouts, both supported since API 1 as far as I can tell. Getting the following error :

08-23 13:20:45.567: ERROR/AndroidRuntime(801): Uncaught handler: thread main exiting due to uncaught exception
08-23 13:20:45.577: ERROR/AndroidRuntime(801): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.munzee.android.client/com.munzee.android.client.LogInActivity}: android.view.InflateException: Binary XML file line #22: Error inflating class java.lang.reflect.Constructor
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.app.ActivityThread.access$1800(ActivityThread.java:112)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.os.Looper.loop(Looper.java:123)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.app.ActivityThread.main(ActivityThread.java:3948)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at java.lang.reflect.Method.invokeNative(Native Method)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at java.lang.reflect.Method.invoke(Method.java:521)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at dalvik.system.NativeStart.main(Native Method)
08-23 13:20:45.577: ERROR/AndroidRuntime(801): Caused by: android.view.InflateException: Binary XML file line #22: Error inflating class java.lang.reflect.Constructor
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.view.LayoutInflater.createView(LayoutInflater.java:512)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:562)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:617)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:620)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:309)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.app.Activity.setContentView(Activity.java:1626)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at com.munzee.android.client.LogInActivity.onCreate(LogInActivity.java:74)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.app.Instrumentat开发者_开发百科ion.callActivityOnCreate(Instrumentation.java:1123)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     ... 11 more
08-23 13:20:45.577: ERROR/AndroidRuntime(801): Caused by: java.lang.reflect.InvocationTargetException
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.widget.ImageView.<init>(ImageView.java:103)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at java.lang.reflect.Constructor.constructNative(Native Method)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.view.LayoutInflater.createView(LayoutInflater.java:499)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     ... 23 more
08-23 13:20:45.577: ERROR/AndroidRuntime(801): Caused by: android.content.res.Resources$NotFoundException: File res/drawable/title_logo.xml from drawable resource ID #0x7f020056
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.content.res.Resources.loadDrawable(Resources.java:1625)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.widget.ImageView.<init>(ImageView.java:113)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     ... 27 more
08-23 13:20:45.577: ERROR/AndroidRuntime(801): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f020058
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.content.res.Resources.getValue(Resources.java:846)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.content.res.Resources.getDrawable(Resources.java:534)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:146)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:749)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.graphics.drawable.Drawable.createFromXml(Drawable.java:695)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     at android.content.res.Resources.loadDrawable(Resources.java:1622)
08-23 13:20:45.577: ERROR/AndroidRuntime(801):     ... 29 more

I looked at another SO post (which suggested removing the drawable-mdpi to the drawable folder), which did not help.

What is crazy is in my R.java there is no resource ID for 0x7f020056 or 0x7f020058...

Chris.


As far as I am aware you are not allowed to have a drawable-mdpi folder if you are building to 1.5. All of the screen size related resource folder modifiers were introduced with android 1.6 (which was the first version of the SDK to support multiple screen sizes). Unless you have a specific reason not to I would suggest building your application to at least SDK version 1.6. There are too many devices with too many different screen sizes out there to make something built with 1.5 look good on all of them. If you must keep your project at 1.5 then you probably just need to get rid of any folders with screen size modifiers so: "drawable-mdpi", "drawable-hdpi", "drawable-ldpi" all need to go away and you should have only "drawable"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜