title: Android - strange errors in logcat not allowing app to run
body: <p>I'm having trouble understanding what the problem is here. My android app doesn't run at all, here's the logcat output.</p>
  
  <pre><code>09-26 20:21:35.609    2540-2540/com.example.savag.myapplication I/art﹕ Not late-enabling -Xcheck:jni (already on)
  09-26 20:21:35.609    2540-2540/com.example.savag.myapplication I/art﹕ Late-enabling JIT
  09-26 20:21:35.646    2540-2540/com.example.savag.myapplication I/art﹕ JIT created with code_cache_capacity=2MB compile_threshold=1000
  09-26 20:21:35.749    2540-2540/com.example.savag.myapplication W/System﹕ ClassLoader referenced unknown path: /data/app/com.example.savag.myapplication-2/lib/x86
  09-26 20:21:36.804    2540-2551/com.example.savag.myapplication I/art﹕ Background sticky concurrent mark sweep GC freed 5990(393KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 10MB/10MB, paused 17.760ms total 60.005ms
  09-26 20:21:36.886    2540-2540/com.example.savag.myapplication I/art﹕ Starting a blocking GC Alloc
  09-26 20:21:36.886    2540-2540/com.example.savag.myapplication I/art﹕ Starting a blocking GC Alloc
  09-26 20:21:36.906    2540-2540/com.example.savag.myapplication I/art﹕ Alloc sticky concurrent mark sweep GC freed 17(848B) AllocSpace objects, 0(0B) LOS objects, 18% free, 17MB/21MB, paused 2.261ms total 18.538ms
  09-26 20:21:36.910    2540-2540/com.example.savag.myapplication I/art﹕ Starting a blocking GC Alloc
  09-26 20:21:36.965    2540-2540/com.example.savag.myapplication I/art﹕ Alloc partial concurrent mark sweep GC freed 18(784B) AllocSpace objects, 0(0B) LOS objects, 18% free, 17MB/21MB, paused 2.299ms total 54.124ms
  09-26 20:21:36.967    2540-2540/com.example.savag.myapplication I/art﹕ Starting a blocking GC Alloc
  09-26 20:21:36.988    2540-2540/com.example.savag.myapplication I/art﹕ Alloc concurrent mark sweep GC freed 8(12KB) AllocSpace objects, 0(0B) LOS objects, 18% free, 17MB/21MB, paused 2.902ms total 19.329ms
  09-26 20:21:36.989    2540-2540/com.example.savag.myapplication I/art﹕ Forcing collection of SoftReferences for 66MB allocation
  09-26 20:21:36.991    2540-2540/com.example.savag.myapplication I/art﹕ Starting a blocking GC Alloc
  09-26 20:21:37.011    2540-2540/com.example.savag.myapplication I/art﹕ Alloc concurrent mark sweep GC freed 11(344B) AllocSpace objects, 0(0B) LOS objects, 18% free, 17MB/21MB, paused 2.322ms total 19.763ms
  09-26 20:21:37.013    2540-2540/com.example.savag.myapplication W/art﹕ Throwing OutOfMemoryError "Failed to allocate a 70056012 byte allocation with 4194304 free bytes and 46MB until OOM"
  09-26 20:21:37.014    2540-2540/com.example.savag.myapplication I/art﹕ Starting a blocking GC Alloc
  09-26 20:21:37.015    2540-2540/com.example.savag.myapplication I/art﹕ Starting a blocking GC Alloc
  09-26 20:21:37.032    2540-2540/com.example.savag.myapplication I/art﹕ Alloc sticky concurrent mark sweep GC freed 3(560B) AllocSpace objects, 0(0B) LOS objects, 18% free, 17MB/21MB, paused 2.341ms total 15.687ms
  09-26 20:21:37.034    2540-2540/com.example.savag.myapplication I/art﹕ Starting a blocking GC Alloc
  09-26 20:21:37.051    2540-2540/com.example.savag.myapplication I/art﹕ Alloc partial concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 18% free, 17MB/21MB, paused 2.313ms total 16.234ms
  09-26 20:21:37.053    2540-2540/com.example.savag.myapplication I/art﹕ Starting a blocking GC Alloc
  09-26 20:21:37.171    2540-2540/com.example.savag.myapplication I/art﹕ Alloc concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 18% free, 17MB/21MB, paused 26.229ms total 116.717ms
  09-26 20:21:37.182    2540-2540/com.example.savag.myapplication I/art﹕ Forcing collection of SoftReferences for 66MB allocation
  09-26 20:21:37.183    2540-2540/com.example.savag.myapplication I/art﹕ Starting a blocking GC Alloc
  09-26 20:21:37.202    2540-2540/com.example.savag.myapplication I/art﹕ Alloc concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 18% free, 17MB/21MB, paused 2.250ms total 17.745ms
  09-26 20:21:37.205    2540-2540/com.example.savag.myapplication W/art﹕ Throwing OutOfMemoryError "Failed to allocate a 70056012 byte allocation with 4194304 free bytes and 46MB until OOM"
  09-26 20:21:37.206    2540-2540/com.example.savag.myapplication D/skia﹕ --- allocation failed for scaled bitmap
  09-26 20:21:37.207    2540-2540/com.example.savag.myapplication D/AndroidRuntime﹕ Shutting down VM
  09-26 20:21:37.207    2540-2540/com.example.savag.myapplication E/AndroidRuntime﹕ FATAL EXCEPTION: main
      Process: com.example.savag.myapplication, PID: 2540
      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.savag.myapplication/com.example.savag.myapplication.MainActivity}: android.view.InflateException: Binary XML file line #34: Binary XML file line #34: Error inflating class &lt;unknown&gt;
              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 #34: Binary XML file line #34: Error inflating class &lt;unknown&gt;
              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:255)
              at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
              at com.example.savag.myapplication.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 #34: Error inflating class &lt;unknown&gt;
              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.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:255)
              at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
              at com.example.savag.myapplication.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.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:255)
              at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
              at com.example.savag.myapplication.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 70056012 byte allocation with 4194304 free bytes and 46MB 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.&lt;init&gt;(View.java:3948)
              at android.view.ViewGroup.&lt;init&gt;(ViewGroup.java:573)
              at android.widget.LinearLayout.&lt;init&gt;(LinearLayout.java:203)
              at android.widget.LinearLayout.&lt;init&gt;(LinearLayout.java:199)
              at android.widget.LinearLayout.&lt;init&gt;(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.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:255)
              at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
              at com.example.savag.myapplication.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)
  </code></pre>
  
  <p>One of the errors I think I know, and that's to do with memory, to be honest I don't have all that much on screen, (in my opinion anyway) I assume I need to do some sort of aysnc to overcome that? The others fly past me without raising an idea.<br>
  Some clarification would be appreciated please.</p>
  
  <p>XML layout added for clarification:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent" android:layout_height="match_parent"
      android:background="@drawable/tugsedit"
      android:orientation="vertical"
      android:gravity="bottom"&gt;
  
      &lt;LinearLayout
          android:orientation="horizontal"
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
          &lt;ImageView
              android:layout_width="match_parent"
              android:layout_height="25dp"
              android:id="@+id/imageView"
              android:layout_gravity="center_vertical"
              android:background="@drawable/topbarmaincenter"
              android:layout_marginTop="30dp" /&gt;
  
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:orientation="horizontal"
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
          &lt;ImageButton
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:id="@+id/imageButton4" /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:orientation="horizontal"
          android:layout_width="match_parent"
          android:layout_height="245dp"
          android:background="@drawable/logoandbar4"
          android:layout_gravity="bottom"
          android:layout_marginBottom="6dp"
          android:weightSum="1"&gt;
  
          &lt;ImageButton
              android:layout_width="59dp"
              android:layout_height="63dp"
              android:id="@+id/imageButton"
              android:layout_gravity="bottom"
              android:background="@drawable/motionbuttonup"
              android:layout_marginLeft="205dp"
              android:layout_marginBottom="1dp" /&gt;
  
          &lt;ImageButton
              android:layout_width="59dp"
              android:layout_height="63dp"
              android:id="@+id/imageButton2"
              android:layout_gravity="bottom"
              android:background="@drawable/positionbuttonup"
              android:layout_marginBottom="1dp"
              android:layout_marginLeft="1dp"
              android:clickable="false" /&gt;
  
          &lt;ImageButton
              android:layout_width="59dp"
              android:layout_height="63dp"
              android:id="@+id/imageButton3"
              android:layout_gravity="bottom"
              android:background="@drawable/envirobuttonup"
              android:layout_marginBottom="1dp"
              android:layout_marginLeft="1dp" /&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>And for the .Java:</p>
  
  <pre><code>package com.example.savag.myapplication;
  
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuItem;
  
  public class MainActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.menu_main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
  
          //noinspection SimplifiableIfStatement
          if (id == R.id.action_settings) {
              return true;
          }
  
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>