我得到這個例外時不時,它的相當煩人我。在我的應用程序,我們只是掃描一個條形碼,它將數據從條形碼發送到server.I已經嘗試了很多事情來清理內存和以避免內存泄漏,但似乎沒有任何工作。任何幫助將appriciated。內存不足異常
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.zxing.client.android/com.example.mypackage.filename}: android.view.InflateException: Binary XML file line #12: Error inflating class at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1652)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1668)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:2852)
at android.app.ActivityThread.access$1600(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:940)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3703)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #12: Error inflating class
at android.view.LayoutInflater.createView(LayoutInflater.java:518)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:212)
at android.app.Activity.setContentView(Activity.java:1657)
at com.example.mypackage.filename.onCreate(TaskSelector.java:164)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1616)
... 12 more Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
at android.view.LayoutInflater.createView(LayoutInflater.java:505)
... 23 more Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
at android.graphics.Bitmap.nativeCreate(Native Method) at android.graphics.Bitmap.createBitmap(Bitmap.java:477)
at android.graphics.Bitmap.createBitmap(Bitmap.java:444)
at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:349)
at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:498)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:473)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
at android.content.res.Resources.loadDrawable(Resources.java:1709)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.view.View.(View.java:1951) at android.view.View.(View.java:1899)
at android.view.ViewGroup.(ViewGroup.java:286) at android.widget.RelativeLayout.(RelativeLayout.java:173) ... 26 more
你可以發佈一些代碼嗎? –
你的XML文件已損壞? – Bevor
有一件事是,Android的活動通常是可取的,直到80視圖,所以如果你可以刪除一些,在第二個注意事項嘗試增加你的IDE的內存,你可能會使用eclipse,並請張貼你認爲你的代碼的一部分可能會導致問題 –