2011-08-23 38 views
0

我有一個問題瓦特/一個非常基本的登錄屏幕。它確實有一個視圖鰭和相對佈局,據我所知,它們都支持API 1。收到以下錯誤:了Android 1.5瓦特/ XML可繪製

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.Instrumentation.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 

我看着另一SO後(其中建議刪除繪製-MDPI到繪製文件夾),這並沒有幫助。

什麼是瘋狂的是在我的R.java沒有用於0x7f020056或0x7f020058沒有資源ID ...

克里斯。

+0

你能證明你這個com.munzee.android.client.LogInActivity文件 – Pratik

回答

1

據我所知,你不能有一個可繪製,MDPI文件夾,如果你正在建設1.5。所有屏幕尺寸相關的資源文件夾修飾符都是在android 1.6(這是支持多種屏幕尺寸的SDK的第一個版本)中引入的。除非你有一個特定的原因,否則我會建議你的應用程序至少構建SDK版本1.6。有太多不同屏幕尺寸的設備太多,使得用1.5製造的東西看起來不錯。如果你必須在1.5使你的項目,那麼你可能只需要擺脫與屏幕尺寸的修飾,所以任何文件夾:「繪製-MDPI」,「繪製 - 華電國際」,「繪製-LDPI」都需要離開,你應該只有「繪製」

+0

的代碼將給出一個鏡頭,謝謝。我們的目標是1.6+,但也收到1.5版本的請求,試圖在那裏工作。 – Chrispix

+2

有些人通過在市場上製作兩個版本的應用程序來處理這種情況,1.5和1.6+。我認爲現在的需求已經消失,現在市場可以讓你上傳不同的apk文件來定位不同的設備。你可能會考慮這樣做。 – FoamyGuy