在我的应用程序中,我在 main.xml 文件中使用了大量布局和大量膨胀。当我将此 xml 设置为 contentview 应用程序崩溃时。在此之前我有两个启动画面。在那些闪屏中,我使用了两个 >200kb 大小的图像。从日志看来,可能是一些内存泄漏问题。这是我的日志:
09-06 03:26:14.749: E/GraphicsJNI(2212): VM won't let us allocate 2764800 bytes
09-06 03:26:14.788: D/AndroidRuntime(2212): Shutting down VM
09-06 03:26:14.788: W/dalvikvm(2212): threadid=1: thread exiting with uncaught exception (group=0x4001d7e0)
09-06 03:26:14.788: I/EXCEPOTION(2212): Aise
09-06 03:26:14.952: E/AndroidRuntime(2212): FATAL EXCEPTION: main
09-06 03:26:14.952: E/AndroidRuntime(2212): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jukte.forgivenessapplication/com.jukte.forgivenessapplication.Home}: android.view.InflateException: Binary XML file line #147: Error inflating class <unknown>
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.os.Handler.dispatchMessage(Handler.java:99)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.os.Looper.loop(Looper.java:123)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.app.ActivityThread.main(ActivityThread.java:4627)
09-06 03:26:14.952: E/AndroidRuntime(2212): at java.lang.reflect.Method.invokeNative(Native Method)
09-06 03:26:14.952: E/AndroidRuntime(2212): at java.lang.reflect.Method.invoke(Method.java:521)
09-06 03:26:14.952: E/AndroidRuntime(2212): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
09-06 03:26:14.952: E/AndroidRuntime(2212): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
09-06 03:26:14.952: E/AndroidRuntime(2212): at dalvik.system.NativeStart.main(Native Method)
09-06 03:26:14.952: E/AndroidRuntime(2212): Caused by: android.view.InflateException: Binary XML file line #147: Error inflating class <unknown>
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
09-06 03:26:14.952: E/AndroidRuntime(2212): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
09-06 03:26:14.952: E/AndroidRuntime(2212): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.app.Activity.setContentView(Activity.java:1647)
09-06 03:26:14.952: E/AndroidRuntime(2212): at com.jukte.forgivenessapplication.Home.onCreate(Home.java:142)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
09-06 03:26:14.952: E/AndroidRuntime(2212): ... 11 more
09-06 03:26:14.952: E/AndroidRuntime(2212): Caused by: java.lang.reflect.InvocationTargetException
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.widget.ScrollView.<init>(ScrollView.java:133)
09-06 03:26:14.952: E/AndroidRuntime(2212): at java.lang.reflect.Constructor.constructNative(Native Method)
09-06 03:26:14.952: E/AndroidRuntime(2212): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
09-06 03:26:14.952: E/AndroidRuntime(2212): ... 22 more
09-06 03:26:14.952: E/AndroidRuntime(2212): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.graphics.Bitmap.nativeCreate(Native Method)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.content.res.Resources.loadDrawable(Resources.java:1709)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.view.View.<init>(View.java:1885)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.view.ViewGroup.<init>(ViewGroup.java:291)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.widget.FrameLayout.<init>(FrameLayout.java:83)
09-06 03:26:14.952: E/AndroidRuntime(2212): at android.widget.ScrollView.<init>(ScrollView.java:137)
09-06 03:26:14.952: E/AndroidRuntime(2212): ... 26 more
我不知道出了什么问题……感谢您的帮助……