logcat上的Android运行时错误

时间:2015-09-25 05:34:28

标签: java android logcat

当我想在avd模拟器中测试我的项目时,我在logcat上遇到以下错误,导致应用程序停止

09-25 12:28:37.495: D/AndroidRuntime(931): Shutting down VM
09-25 12:28:37.495: W/dalvikvm(931): threadid=1: thread exiting with uncaught exception (group=0x40a122a0)
09-25 12:28:37.525: E/AndroidRuntime(931): FATAL EXCEPTION: main
09-25 12:28:37.525: E/AndroidRuntime(931): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mira.canyoutapit/com.mira.canyoutapit.Ablankscreen}: android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.RelativeLayout
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.app.ActivityThread.access$600(ActivityThread.java:130)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.os.Handler.dispatchMessage(Handler.java:99)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.os.Looper.loop(Looper.java:137)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.app.ActivityThread.main(ActivityThread.java:4745)
09-25 12:28:37.525: E/AndroidRuntime(931):  at java.lang.reflect.Method.invokeNative(Native Method)
09-25 12:28:37.525: E/AndroidRuntime(931):  at java.lang.reflect.Method.invoke(Method.java:511)
09-25 12:28:37.525: E/AndroidRuntime(931):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-25 12:28:37.525: E/AndroidRuntime(931):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-25 12:28:37.525: E/AndroidRuntime(931):  at dalvik.system.NativeStart.main(Native Method)
09-25 12:28:37.525: E/AndroidRuntime(931): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.RelativeLayout
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.view.LayoutInflater.createView(LayoutInflater.java:613)
09-25 12:28:37.525: E/AndroidRuntime(931):  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
09-25 12:28:37.525: E/AndroidRuntime(931):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.app.Activity.setContentView(Activity.java:1867)
09-25 12:28:37.525: E/AndroidRuntime(931):  at com.mira.canyoutapit.Ablankscreen.onCreate(Ablankscreen.java:20)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.app.Activity.performCreate(Activity.java:5008)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
09-25 12:28:37.525: E/AndroidRuntime(931):  ... 11 more
09-25 12:28:37.525: E/AndroidRuntime(931): Caused by: java.lang.reflect.InvocationTargetException
09-25 12:28:37.525: E/AndroidRuntime(931):  at java.lang.reflect.Constructor.constructNative(Native Method)
09-25 12:28:37.525: E/AndroidRuntime(931):  at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.view.LayoutInflater.createView(LayoutInflater.java:587)
09-25 12:28:37.525: E/AndroidRuntime(931):  ... 23 more
09-25 12:28:37.525: E/AndroidRuntime(931): Caused by: java.lang.OutOfMemoryError
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:353)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.content.res.Resources.loadDrawable(Resources.java:1935)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.view.View.<init>(View.java:3336)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.view.View.<init>(View.java:3273)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.view.ViewGroup.<init>(ViewGroup.java:421)
09-25 12:28:37.525: E/AndroidRuntime(931):  at android.widget.RelativeLayout.<init>(RelativeLayout.java:184)
09-25 12:28:37.525: E/AndroidRuntime(931):  ... 26 more
09-25 12:28:41.985: I/Process(931): Sending signal. PID: 931 SIG: 9

任何人都可以告诉我以下错误是什么意思?所以我可以修复项目中的错误

感谢的

2 个答案:

答案 0 :(得分:0)

根据您发布的日志,可能是由以下原因引起的:

  1. 打开一张非常大的图片。
  2. 打开太多图片而不释放它们。
  3. 或其他原因,取决于您的实施,在这种情况下,您最好宣布您的意图并发布您的代码。

答案 1 :(得分:0)

清单文件中尝试android:largeHeap="true"并降低您使用的图片的分辨率