java.lang.RuntimeException: Unable to start activity ComponentInfo

一个错误找了好久,找到怀疑人生,居然是图片大小的问题!!!

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_main); //就是这一行报错
    }
}

报错信息

  1. java.lang.RuntimeException: Unable to start activity
  2. android.view.InflateException: Binary XML file line #22: Binary XML
    file line #22: Error inflating class
10-09 21:45:07.393 1838-1838/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                 Process: com.example.yipai.qq_demo, PID: 1838
                                                 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.yipai.qq_demo/com.example.yipai.qq_demo.MainActivity}: android.view.InflateException: Binary XML file line #22: Binary XML file line #22: Error inflating class 
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                     at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                     at android.os.Handler.dispatchMessage(Handler.java:102)
                                                     at android.os.Looper.loop(Looper.java:148)
                                                     at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                  Caused by: android.view.InflateException: Binary XML file line #22: Binary XML file line #22: Error inflating class 
                                                     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.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
                                                     at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                                                     at com.example.yipai.qq_demo.MainActivity.onCreate(MainActivity.java:13)
                                                     at android.app.Activity.performCreate(Activity.java:6237)
                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                     at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                     at android.os.Looper.loop(Looper.java:148) 
                                                     at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                     at java.lang.reflect.Method.invoke(Native Method) 
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                                                  Caused by: android.view.InflateException: Binary XML file line #22: Error inflating class 
                                                     at android.view.LayoutInflater.createView(LayoutInflater.java:645)
                                                     at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
                                                     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)
                                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
                                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
                                                     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
                                                     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
                                                     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                                                     at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280) 
                                                     at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                                                     at com.example.yipai.qq_demo.MainActivity.onCreate(MainActivity.java:13) 
                                                     at android.app.Activity.performCreate(Activity.java:6237) 
                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                     at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                     at android.os.Looper.loop(Looper.java:148) 
                                                     at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                     at java.lang.reflect.Method.invoke(Native Method) 
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                                                  Caused by: java.lang.reflect.InvocationTargetException
                                                     at java.lang.reflect.Constructor.newInstance(Native Method)
                                                     at android.view.LayoutInflater.createView(LayoutInflater.java:619)
                                                     at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58) 
                                                     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694) 
                                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762) 
                                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) 
                                                     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) 
                                                     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) 
                                                     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                                                     at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280) 
                                                     at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                                                     at com.example.yipai.qq_demo.MainActivity.onCreate(MainActivity.java:13) 
                                                     at android.app.Activity.performCreate(Activity.java:6237) 
                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                     at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                     at android.os.Looper.loop(Looper.java:148) 
                                                     at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                     at java.lang.reflect.Method.invoke(Native Method) 
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                                                  Caused by: java.lang.OutOfMemoryError: Failed to allocate a 56678412 byte allocation with 16765264 free bytes and 37MB until OOM
                                                     at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
                                                     at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
                                                     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)
                                                     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
                                                     at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1080)
                                                     at android.content.res.Resources.loadDrawableForCookie(Resources.java:2635)
                                                     at android.content.res.Resources.loadDrawable(Resources.java:2540)
                                                     at android.content.res.TypedArray.getDrawable(TypedArray.java:870)
                                                     at android.view.View.(View.java:3948)
                                                     at android.view.ViewGroup.(ViewGroup.java:573)
                                                     at android.widget.LinearLayout.(LinearLayout.java:203)
                                                     at android.widget.LinearLayout.(LinearLayout.java:199)
                                                     at android.widget.LinearLayout.(LinearLayout.java:195)
                                                     at java.lang.reflect.Constructor.newInstance(Native Method) 
                                                     at android.view.LayoutInflater.createView(LayoutInflater.java:619) 
                                                     at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58) 
                                                     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694) 
                                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762) 
                                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) 
                                                     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) 
                                                     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) 
                                                     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                                                     at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280) 
                                                     at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                                                     at com.example.yipai.qq_demo.MainActivity.onCreate(MainActivity.java:13) 
                                                     at android.app.Activity.performCreate(Activity.java:6237) 
                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                                                     at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                     at android.os.Looper.loop(Looper.java:148) 
                                                     at android.app.ActivityThread.main(ActivityThread.java:5417) 
                                                     at java.lang.reflect.Method.invoke(Native Method) 
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

你可能感兴趣的:(布局,错误)