我的应用程序崩溃了!需要帮助..在logcat中似乎有一个错误

时间:2017-05-10 13:46:58

标签: android inflate-exception

05-10 19:09:13.744 17071-17071/com.example.personal.enco E/AndroidRuntime: FATAL EXCEPTION: main
     Process: com.example.personal.enco, PID: 17071
     java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.personal.enco/com.example.personal.enco.MainActivity}: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class android.support.constraint.RelativeLayout
         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2426)
         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2490)
         at android.app.ActivityThread.-wrap11(ActivityThread.java)
         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1354)
         at android.os.Handler.dispatchMessage(Handler.java:102)
         at android.os.Looper.loop(Looper.java:148)
         at android.app.ActivityThread.main(ActivityThread.java:5443)
         at java.lang.reflect.Method.invoke(Native Method)
         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
      Caused by: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class android.support.constraint.RelativeLayout
         at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
         at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
         at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
         at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:288)
         at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
         at com.example.personal.enco.MainActivity.onCreate(MainActivity.java:12)
         at android.app.Activity.performCreate(Activity.java:6259)
         at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1130)
         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)
         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2490) 
         at android.app.ActivityThread.-wrap11(ActivityThread.java) 
         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1354) 
         at android.os.Handler.dispatchMessage(Handler.java:102) 
         at android.os.Looper.loop(Looper.java:148) 
         at android.app.ActivityThread.main(ActivityThread.java:5443) 
         at java.lang.reflect.Method.invoke(Native Method) 
         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) 
         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 
      Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.support.constraint.RelativeLayout
         at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
         at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
         at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
         at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
         at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
         at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:288) 
         at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
         at com.example.personal.enco.MainActivity.onCreate(MainActivity.java:12) 
         at android.app.Activity.performCreate(Activity.java:6259) 
         at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1130) 
         at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379) 
         at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2490) 
         at android.app.ActivityThread.-wrap11(ActivityThread.java) 
         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1354) 
         at android.os.Handler.dispatchMessage(Handler.java:102) 
         at android.os.Looper.loop(Looper.java:148) 
         at android.app.ActivityThread.main(ActivityThread.java:5443) 
         at java.lang.reflect.Method.invoke(Native Method) 
         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) 
         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 
      Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.constraint.RelativeLayout" on path: DexPathList[[zip file "/data/app/com.example.personal.enco-1/base.apk", zip file "/data/app/com.example.personal.enco-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.personal.enco-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.personal.enco-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.personal.enco-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.personal.enco-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.personal.enco-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.personal.enco-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.personal.enco-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.personal.enco-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.personal.enco-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.personal.enco-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.personal.enco-1/lib/arm, /data/app/com.example.personal.enco-1/base.apk!/lib/armeabi-v7a, /data/app/com.example.personal.enco-1/split_lib_dependencies_apk.apk!/lib/armeabi-v7a, /data/app/com.example.personal.enco-1/split_lib_slice_0_apk.apk!/lib/armeabi-v7a, /data/app/com.example.personal.enco-1/split_lib_slice_1_apk.apk!/lib/armeabi-v7a, /data/app/com.example.personal.enco-1/split_lib_slice_2_apk.apk!/lib/armeabi-v7a, /data/app/com.example.personal.enco-1/split_lib_slice_3_apk.apk!/lib/armeabi-v7a, /data/app/com.example.personal.enco-1/split_lib_slice_4_apk.apk!/lib/armeabi-v7a, /data/app/com.example.personal.enco-1/split_lib_slice_5_apk.apk!/lib/armeabi-v7a, /data/app/com.example.personal.enco-1/split_lib_slice_6_apk.apk!/lib/armeabi-v7a, /data/app/com.example.person

2 个答案:

答案 0 :(得分:2)

android.view.InflateException: Binary XML file line #2: Error inflating class android.support.constraint.RelativeLayout

您有一个布局资源,其中有一个名为android.support.constraint.RelativeLayout的XML元素。 Android中没有这样的类。 RelativeLayout可以在您的布局中简称为RelativeLayout

答案 1 :(得分:0)

您可以发布开发应用程序的API吗? 你做过任何更新?检查你的SDK包,

或者

使用一个线性布局或相对布局创建一个activity2.xml,并通过删除u setContentView中的旧activity1.xml来申请活动,然后运行应用程序..

试试这个