2012-10-31 66 views
-1

問題是我的應用程序在將某些圖像添加到資源文件夾之前運行得很好。添加後,它停止工作。我查看了每個圖片的擴展名,但最終我被卡住了,但是出現了以下logcat消息。還有一件事是在大型普通設備上正常工作,但不適用於小型設備。提前致謝。android.view.InflateException:二進制XML文件行#83:錯誤膨脹類<unknown>

10-31 11:18:25.431: E/AndroidRuntime(637): FATAL EXCEPTION: main 
10-31 11:18:25.431: E/AndroidRuntime(637): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.newdesign/com.example.newdesign.Recipe}: android.view.InflateException: Binary XML file line #83: Error inflating class <unknown> 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.app.ActivityThread.access$600(ActivityThread.java:123) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.os.Handler.dispatchMessage(Handler.java:99) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.os.Looper.loop(Looper.java:137) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.app.ActivityThread.main(ActivityThread.java:4424) 
10-31 11:18:25.431: E/AndroidRuntime(637): at java.lang.reflect.Method.invokeNative(Native Method) 
10-31 11:18:25.431: E/AndroidRuntime(637): at java.lang.reflect.Method.invoke(Method.java:511) 
10-31 11:18:25.431: E/AndroidRuntime(637): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 
10-31 11:18:25.431: E/AndroidRuntime(637): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 
10-31 11:18:25.431: E/AndroidRuntime(637): at dalvik.system.NativeStart.main(Native Method) 
10-31 11:18:25.431: E/AndroidRuntime(637): Caused by: android.view.InflateException: Binary XML file line #83: Error inflating class <unknown> 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.view.LayoutInflater.createView(LayoutInflater.java:606) 
10-31 11:18:25.431: E/AndroidRuntime(637): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
10-31 11:18:25.431: E/AndroidRuntime(637): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.app.Activity.setContentView(Activity.java:1835) 
10-31 11:18:25.431: E/AndroidRuntime(637): at com.example.newdesign.Recipe.onCreate(Recipe.java:58) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.app.Activity.performCreate(Activity.java:4465) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920) 
10-31 11:18:25.431: E/AndroidRuntime(637): ... 11 more 
10-31 11:18:25.431: E/AndroidRuntime(637): Caused by: java.lang.reflect.InvocationTargetException 
10-31 11:18:25.431: E/AndroidRuntime(637): at java.lang.reflect.Constructor.constructNative(Native Method) 
10-31 11:18:25.431: E/AndroidRuntime(637): at java.lang.reflect.Constructor.newInstance(Constructor.java:417) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.view.LayoutInflater.createView(LayoutInflater.java:586) 
10-31 11:18:25.431: E/AndroidRuntime(637): ... 24 more 
10-31 11:18:25.431: E/AndroidRuntime(637): Caused by: java.lang.OutOfMemoryError 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:483) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:351) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:773) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.content.res.Resources.loadDrawable(Resources.java:1935) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.content.res.TypedArray.getDrawable(TypedArray.java:601) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.view.View.<init>(View.java:2785) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.view.View.<init>(View.java:2722) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.view.ViewGroup.<init>(ViewGroup.java:379) 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.widget.RelativeLayout.<init>(RelativeLayout.java:174) 
10-31 11:18:25.431: E/AndroidRuntime(637): ... 27 more 
+0

你有什麼問題?你對我們的期望是什麼?你能否多解釋一下,以便我們能從中理解一些東西。 – Akshay

+0

請在'Recipe.java'中的#58行附近粘貼幾行代碼。 – Gagan

+0

@Akshay tittle完全解釋了......你有沒有得到這個錯誤 – Rohit

回答

3

來看由這些線

Caused by: java.lang.OutOfMemoryError 
10-31 11:18:25.431: E/AndroidRuntime(637): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) 

它看起來你是什麼地方有太大的位圖(在可能的資源)

+0

是的,但如何解決這個問題。和我的應用程序運行在一個設備上,但其他失敗...請幫助 – Rohit

+1

謝謝。你的回答幫助了我。當我檢查我的資源文件夾的圖像時,其中一個具有2000 * 3012分辨率。感謝Alex。 – Rohit

相關問題