我已经使用了1920x1080分辨率图像用于所有布局背景。我得到了OutOfMemory异常。然后我在不同的文件夹中使用不同的图像用于不同的分辨率,但我仍然得到OutOfMemory异常。请任何人帮助我.Below是我的logcat中。
E/AndroidRuntime( 3997): FATAL EXCEPTION: main
E/AndroidRuntime( 3997): Process: com.pm.a, PID: 3997
E/AndroidRuntime( 3997): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.pm.a/com.activities.services.ConfirmDetails}: android.view.InflateException: Binary XML file line #48: Error inflating class <unknown>
E/AndroidRuntime( 3997): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2305)
E/AndroidRuntime( 3997): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
E/AndroidRuntime( 3997): at android.app.ActivityThread.access$900(ActivityThread.java:161)
E/AndroidRuntime( 3997): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
E/AndroidRuntime( 3997): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 3997): at android.os.Looper.loop(Looper.java:157)
E/AndroidRuntime( 3997): at android.app.ActivityThread.main(ActivityThread.java:5356)
E/AndroidRuntime( 3997): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3997): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 3997): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
E/AndroidRuntime( 3997): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
E/AndroidRuntime( 3997): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 3997): Caused by: android.view.InflateException: Binary XML file line #48: Error inflating class <unknown>
E/AndroidRuntime( 3997): at android.view.LayoutInflater.createView(LayoutInflater.java:626)
E/AndroidRuntime( 3997): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
E/AndroidRuntime( 3997): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:675)
E/AndroidRuntime( 3997): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:700)
E/AndroidRuntime( 3997): at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
E/AndroidRuntime( 3997): at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
E/AndroidRuntime( 3997): at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
E/AndroidRuntime( 3997): at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
E/AndroidRuntime( 3997): at android.view.LayoutInflater.rInflate(LayoutInflater.java:769)
E/AndroidRuntime( 3997): at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
E/AndroidRuntime( 3997): at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
E/AndroidRuntime( 3997): at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
E/AndroidRuntime( 3997): at com.activities.services.ConfirmDetails.onCreate(ConfirmDetails.java:90)
E/AndroidRuntime( 3997): at android.app.Activity.performCreate(Activity.java:5426)
E/AndroidRuntime( 3997): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
E/AndroidRuntime( 3997): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
E/AndroidRuntime( 3997): ... 11 more
E/AndroidRuntime( 3997): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime( 3997): at java.lang.reflect.Constructor.constructNative(Native Method)
E/AndroidRuntime( 3997): at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
E/AndroidRuntime( 3997): at android.view.LayoutInflater.createView(LayoutInflater.java:600)
E/AndroidRuntime( 3997): ... 26 more
E/AndroidRuntime( 3997): Caused by: java.lang.OutOfMemoryError
E/AndroidRuntime( 3997): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
E/AndroidRuntime( 3997): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:677)
E/AndroidRuntime( 3997): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:507)
E/AndroidRuntime( 3997): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:872)
E/AndroidRuntime( 3997): at android.content.res.Resources.loadDrawable(Resources.java:3056)
E/AndroidRuntime( 3997): at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
E/AndroidRuntime( 3997): at android.widget.ImageView.<init>(ImageView.java:133)
E/AndroidRuntime( 3997): at android.widget.ImageView.<init>(ImageView.java:123)
E/AndroidRuntime( 3997): ... 29 more
W/ActivityManager( 3050): Force finishing activity com.activities.services.ConfirmDetails
提前感谢。
答案 0 :(得分:1)