当我尝试在手机上运行时,应用程序一直停止(android studio)

时间:2018-06-05 05:30:01

标签: android

当我在手机上运行我的android studio应用程序时出现错误。它说我的应用程序一直停止并且无法加载它。

以下是我从日志中得到的错误:

06-05 17:22:55.578 2715-2715 / com.app.supermarketaislefinder E / AndroidRuntime:FATAL EXCEPTION:main     流程:com.app.supermarketaislefinder,PID:2715     java.lang.RuntimeException:无法启动活动ComponentInfo {com.app.supermarketaislefinder / com.app.supermarketaislefinder.MainActivity}:android.view.InflateException:二进制XML文件行#2:二进制XML文件行#2:错误膨胀类android.support.constraint.ConstraintLayout         在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2724)         在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2789)         在android.app.ActivityThread.-wrap12(ActivityThread.java)         在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1527)         在android.os.Handler.dispatchMessage(Handler.java:110)         在android.os.Looper.loop(Looper.java:203)         在android.app.ActivityThread.main(ActivityThread.java:6251)         at java.lang.reflect.Method.invoke(Native Method)         在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:1063)         在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)      引起:android.view.InflateException:二进制XML文件行#2:二进制XML文件行#2:错误膨胀类android.support.constraint.ConstraintLayout      引起:android.view.InflateException:二进制XML文件行#2:错误膨胀类android.support.constraint.ConstraintLayout      引起:java.lang.reflect.InvocationTargetException         at java.lang.reflect.Constructor.newInstance0(Native Method)         at java.lang.reflect.Constructor.newInstance(Constructor.java:430)         在android.view.LayoutInflater.createView(LayoutInflater.java:645)         在android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)         在android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)         在android.view.LayoutInflater.inflate(LayoutInflater.java:495)         在android.view.LayoutInflater.inflate(LayoutInflater.java:426)         在android.view.LayoutInflater.inflate(LayoutInflater.java:377)         在android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)         在android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)         在com.app.supermarketaislefinder.MainActivity.onCreate(MainActivity.java:11)         在android.app.Activity.performCreate(Activity.java:6676)         在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)         在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2677)         在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2789)         在android.app.ActivityThread.-wrap12(ActivityThread.java)         在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1527)         在android.os.Handler.dispatchMessage(Handler.java:110)         在android.os.Looper.loop(Looper.java:203)         在android.app.ActivityThread.main(ActivityThread.java:6251)         at java.lang.reflect.Method.invoke(Native Method)         在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:1063)         在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)      引起:java.lang.OutOfMemoryError:无法分配带有4154252个空闲字节的207936012字节分配和直到OOM的186MB         at dalvik.system.VMRuntime.newNonMovableArray(Native Method)         在android.graphics.BitmapFactory.nativeDecodeAsset(本机方法)         在android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:655)         在android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:483)         在android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1157)         在android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:720)         在android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:571)         在android.content.res.Resources.loadDrawable(Resources.java:972)         在android.content.res.TypedArray.getDrawable(TypedArray.java:931)         在android.view.View。(View.java:4226)         在android.view.ViewGroup。(ViewGroup.java:603)         在android.view.ViewGroup。(ViewGroup.java:599)         在android.view.ViewGroup。(ViewGroup.java:595)         在android.support.constraint.ConstraintLayout。(ConstraintLayout.java:565)

感谢。

1 个答案:

答案 0 :(得分:0)

这是一个观点通胀错误, 重新检查你的活动中的膨胀(R.id.activitylayouttoinflate) 尝试按住CTRL并单击它以到达xml, 然后检查xml是否为syntex error \ unsupported library。

针对您提出的第二个问题发布不同的问题。