刚才我将一个现有的Android应用程序导入到我的系统中。它会在
行的以下xml文件中导致InflateExceotion<ImageView
我不知道为什么会发生这个错误。因为,它在另一个系统中成功运行
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageView
android:id="@+id/image1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:background="@drawable/svs"
/>
</RelativeLayout>
logcat的:
03-29 10:55:37.621: E/AndroidRuntime(941): FATAL EXCEPTION: main
03-29 10:55:37.621: E/AndroidRuntime(941): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app/com.app.ScreenActivity}: android.view.InflateException: Binary XML file line #4: Error inflating class <unknown>
03-29 10:55:37.621: E/AndroidRuntime(941): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.os.Handler.dispatchMessage(Handler.java:99)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.os.Looper.loop(Looper.java:137)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.app.ActivityThread.main(ActivityThread.java:5041)
03-29 10:55:37.621: E/AndroidRuntime(941): at java.lang.reflect.Method.invokeNative(Native Method)
03-29 10:55:37.621: E/AndroidRuntime(941): at java.lang.reflect.Method.invoke(Method.java:511)
03-29 10:55:37.621: E/AndroidRuntime(941): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-29 10:55:37.621: E/AndroidRuntime(941): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-29 10:55:37.621: E/AndroidRuntime(941): at dalvik.system.NativeStart.main(Native Method)
03-29 10:55:37.621: E/AndroidRuntime(941): Caused by: android.view.InflateException: Binary XML file line #4: Error inflating class <unknown>
03-29 10:55:37.621: E/AndroidRuntime(941): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
03-29 10:55:37.621: E/AndroidRuntime(941): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-29 10:55:37.621: E/AndroidRuntime(941): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.app.Activity.setContentView(Activity.java:1881)
03-29 10:55:37.621: E/AndroidRuntime(941): at com.app.ScreenActivity.onCreate(ScreenActivity.java:19)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.app.Activity.performCreate(Activity.java:5104)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
03-29 10:55:37.621: E/AndroidRuntime(941): ... 11 more
03-29 10:55:37.621: E/AndroidRuntime(941): Caused by: java.lang.reflect.InvocationTargetException
03-29 10:55:37.621: E/AndroidRuntime(941): at java.lang.reflect.Constructor.constructNative(Native Method)
03-29 10:55:37.621: E/AndroidRuntime(941): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
03-29 10:55:37.621: E/AndroidRuntime(941): ... 24 more
03-29 10:55:37.621: E/AndroidRuntime(941): Caused by: java.lang.OutOfMemoryError
03-29 10:55:37.621: E/AndroidRuntime(941): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:502)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:355)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:785)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.content.res.Resources.loadDrawable(Resources.java:1965)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.view.View.<init>(View.java:3330)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.widget.ImageView.<init>(ImageView.java:114)
03-29 10:55:37.621: E/AndroidRuntime(941): at android.widget.ImageView.<init>(ImageView.java:110)
03-29 10:55:37.621: E/AndroidRuntime(941): ... 27 more
有人可以帮我避免这个错误
答案 0 :(得分:0)
您的内存不足错误。 “svs”形象有多大?不同的手机有不同的规格以及不同的运行方式。两台设备之间的OOM是完全合理的。
减小svs的大小。