title: Error Caused by: java.lang.reflect.InvocationTargetException
body: <p>Im trying to make a simple memory game, by now I only done the XML code.
  but for some reson i cant understand, at the logcat i get an error 
  <code>Caused by: java.lang.reflect.InvocationTargetException</code> 
  at this java line:<code>setContentView(R.layout.activity_main);</code>.</p>
  
  <p>this line was wrote by the app when i created it automatically.</p>
  
  <p>here is my XML code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:padding="20dp"
      android:orientation="vertical"
      tools:context=".MainActivity"
      android:background="@drawable/background"&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_gravity="center"
          android:textSize="40sp"
          android:fontFamily="@font/hearthstonefont"
          android:layout_height="wrap_content"
          android:text="@string/title" /&gt;
  
      &lt;EditText
          android:id="@+id/editText"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:ems="10"
          android:inputType="textPersonName"
          android:hint="@string/hint"
          android:fontFamily="@font/hearthstonefont" /&gt;
  
      &lt;TextView
          android:id="@+id/tvGame"
          android:textSize="20sp"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:text="@string/pCounter"
          android:fontFamily="@font/hearthstonefont" /&gt;
  
      &lt;TextView
          android:id="@+id/tvPoints"
          android:textSize="20sp"
          android:layout_marginBottom="20dp"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:text="@string/gCounter"
          android:fontFamily="@font/hearthstonefont" /&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal"&gt;
  
          &lt;ImageButton
              android:id="@+id/imageButton"
              android:layout_width="150dp"
              android:layout_height="180dp"
              android:layout_weight="1"
              android:contentDescription="@string/title"
              android:scaleType="fitEnd"
              android:background="@android:color/transparent"
              android:src="@drawable/cardback"/&gt;
  
          &lt;ImageButton
              android:id="@+id/ibum"
              android:layout_width="150dp"
              android:layout_height="180dp"
              android:layout_weight="1"
              android:background="@android:color/transparent"
              android:scaleType="fitEnd"
              android:contentDescription="@string/title"
              android:src="@drawable/cardback" /&gt;
  
          &lt;ImageButton
              android:id="@+id/ibur"
              android:layout_width="150dp"
              android:layout_height="180dp"
              android:layout_weight="1"
              android:contentDescription="@string/title"
              android:background="@android:color/transparent"
              android:scaleType="fitEnd"
              android:src="@drawable/cardback" /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal"
          android:gravity="center"&gt;
  
          &lt;ImageButton
              android:id="@+id/ibdl"
              android:layout_width="150dp"
              android:layout_height="180dp"
              android:layout_weight="1"
              android:contentDescription="@string/title"
              android:background="@android:color/transparent"
              android:scaleType="fitEnd"
              android:src="@drawable/cardback"  /&gt;
  
          &lt;ImageButton
              android:id="@+id/ibdm"
              android:layout_width="150dp"
              android:contentDescription="@string/title"
              android:layout_height="180dp"
              android:layout_weight="1"
              android:scaleType="fitEnd"
              android:background="@android:color/transparent"
              android:src="@drawable/cardback"  /&gt;
  
          &lt;ImageButton
              android:id="@+id/ibdr"
              android:contentDescription="@string/title"
              android:layout_width="150dp"
              android:layout_height="180dp"
              android:layout_weight="1"
              android:background="@android:color/transparent"
              android:scaleType="fitEnd"
              android:src="@drawable/cardback"  /&gt;
  
      &lt;/LinearLayout&gt;
  
      &lt;Space
          android:layout_width="match_parent"
          android:layout_height="wrap_content" /&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal"
          android:gravity="bottom" &gt;
  
          &lt;Button
              android:id="@+id/btnNewGame"
              android:layout_width="150dp"
              android:layout_height="100dp"
              android:layout_weight="1"
              style="@style/Widget.AppCompat.Button.Borderless"
              android:background="@drawable/btngood"
              android:fontFamily="@font/hearthstonefont"
              android:text="@string/btnNewGame"
              android:textSize="17sp"/&gt;
  
          &lt;Button
              android:id="@+id/btNewPlayer"
              android:background="@drawable/btngood"
              android:layout_width="150dp"
              style="@style/Widget.AppCompat.Button.Borderless"
              android:layout_height="100dp"
              android:layout_weight="1"
              android:fontFamily="@font/hearthstonefont"
              android:text="@string/btnNewPlayer"
              android:textSize="17sp"/&gt;
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>here is my java code:</p>
  
  <pre><code>package com.example.maor_memorygame;
  
  import androidx.appcompat.app.AppCompatActivity;
  
  import android.os.Bundle;
  
  public class MainActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
      }
  }
  </code></pre>
  
  <p>logcat:</p>
  
  <pre><code>2020-01-19 15:20:05.672 1139-1139/? I/art: Not late-enabling -Xcheck:jni (already on)
  2020-01-19 15:20:05.673 1139-1139/? W/art: Unexpected CPU variant for X86 using defaults: x86
  2020-01-19 15:20:05.791 1139-1139/com.example.maor_memorygame W/System: ClassLoader referenced unknown path: /data/app/com.example.maor_memorygame-2/lib/x86
  2020-01-19 15:20:05.849 1139-1139/com.example.maor_memorygame W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
  2020-01-19 15:20:05.876 1139-1139/com.example.maor_memorygame I/art: Rejecting re-init on previously-failed class java.lang.Class&lt;androidx.core.view.ViewCompat$OnUnhandledKeyEventListenerWrapper&gt;: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener;
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at void androidx.core.view.ViewCompat.setBackground(android.view.View, android.graphics.drawable.Drawable) (ViewCompat.java:2341)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at void androidx.appcompat.widget.ActionBarContainer.&lt;init&gt;(android.content.Context, android.util.AttributeSet) (ActionBarContainer.java:62)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at java.lang.Object java.lang.reflect.Constructor.newInstance0!(java.lang.Object[]) (Constructor.java:-2)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at java.lang.Object java.lang.reflect.Constructor.newInstance(java.lang.Object[]) (Constructor.java:430)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at android.view.View android.view.LayoutInflater.createView(java.lang.String, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:645)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:787)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet) (LayoutInflater.java:727)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:858)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at void android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, android.view.View, android.util.AttributeSet, boolean) (LayoutInflater.java:821)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at android.view.View android.view.LayoutInflater.inflate(org.xmlpull.v1.XmlPullParser, android.view.ViewGroup, boolean) (LayoutInflater.java:518)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup, boolean) (LayoutInflater.java:426)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup) (LayoutInflater.java:377)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at android.view.ViewGroup androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:607)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at void androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:518)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at void androidx.appcompat.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:466)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at void androidx.appcompat.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:140)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at void com.example.maor_memorygame.MainActivity.onCreate(android.os.Bundle) (MainActivity.java:12)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6679)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1118)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2618)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2726)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1477)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at void android.os.Looper.loop() (Looper.java:154)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6119)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:886)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:776)
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.example.maor_memorygame-2/base.apk"],nativeLibraryDirectories=[/data/app/com.example.maor_memorygame-2/lib/x86, /system/lib, /vendor/lib]]
  2020-01-19 15:20:05.877 1139-1139/com.example.maor_memorygame I/art:     at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at void androidx.core.view.ViewCompat.setBackground(android.view.View, android.graphics.drawable.Drawable) (ViewCompat.java:2341)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at void androidx.appcompat.widget.ActionBarContainer.&lt;init&gt;(android.content.Context, android.util.AttributeSet) (ActionBarContainer.java:62)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at java.lang.Object java.lang.reflect.Constructor.newInstance0!(java.lang.Object[]) (Constructor.java:-2)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at java.lang.Object java.lang.reflect.Constructor.newInstance(java.lang.Object[]) (Constructor.java:430)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at android.view.View android.view.LayoutInflater.createView(java.lang.String, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:645)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:787)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet) (LayoutInflater.java:727)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:858)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at void android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, android.view.View, android.util.AttributeSet, boolean) (LayoutInflater.java:821)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at android.view.View android.view.LayoutInflater.inflate(org.xmlpull.v1.XmlPullParser, android.view.ViewGroup, boolean) (LayoutInflater.java:518)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup, boolean) (LayoutInflater.java:426)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup) (LayoutInflater.java:377)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at android.view.ViewGroup androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:607)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at void androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:518)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at void androidx.appcompat.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:466)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at void androidx.appcompat.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:140)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at void com.example.maor_memorygame.MainActivity.onCreate(android.os.Bundle) (MainActivity.java:12)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6679)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1118)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2618)
  2020-01-19 15:20:05.878 1139-1139/com.example.maor_memorygame I/art:     at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2726)
  2020-01-19 15:20:05.879 1139-1139/com.example.maor_memorygame I/art:     at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
  2020-01-19 15:20:05.879 1139-1139/com.example.maor_memorygame I/art:     at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1477)
  2020-01-19 15:20:05.879 1139-1139/com.example.maor_memorygame I/art:     at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
  2020-01-19 15:20:05.880 1139-1139/com.example.maor_memorygame I/art:     at void android.os.Looper.loop() (Looper.java:154)
  2020-01-19 15:20:05.880 1139-1139/com.example.maor_memorygame I/art:     at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6119)
  2020-01-19 15:20:05.880 1139-1139/com.example.maor_memorygame I/art:     at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
  2020-01-19 15:20:05.880 1139-1139/com.example.maor_memorygame I/art:     at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:886)
  2020-01-19 15:20:05.880 1139-1139/com.example.maor_memorygame I/art:     at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:776)
  2020-01-19 15:20:06.348 1139-1139/com.example.maor_memorygame I/art: Starting a blocking GC Alloc
  2020-01-19 15:20:06.348 1139-1139/com.example.maor_memorygame I/art: Starting a blocking GC Alloc
  2020-01-19 15:20:06.368 1139-1139/com.example.maor_memorygame I/art: Alloc partial concurrent mark sweep GC freed 9304(551KB) AllocSpace objects, 0(0B) LOS objects, 37% free, 6MB/10MB, paused 1.534ms total 18.933ms
  2020-01-19 15:20:06.368 1139-1139/com.example.maor_memorygame I/art: Starting a blocking GC Alloc
  2020-01-19 15:20:06.379 1139-1139/com.example.maor_memorygame I/art: Alloc sticky concurrent mark sweep GC freed 0(0B) AllocSpace objects, 0(0B) LOS objects, 37% free, 6MB/10MB, paused 1.315ms total 10.152ms
  2020-01-19 15:20:06.379 1139-1139/com.example.maor_memorygame I/art: Starting a blocking GC Alloc
  2020-01-19 15:20:06.398 1139-1139/com.example.maor_memorygame I/art: Alloc concurrent mark sweep GC freed 126(5KB) AllocSpace objects, 0(0B) LOS objects, 37% free, 6MB/10MB, paused 1.371ms total 18.414ms
  2020-01-19 15:20:06.398 1139-1139/com.example.maor_memorygame I/art: Forcing collection of SoftReferences for 387MB allocation
  2020-01-19 15:20:06.398 1139-1139/com.example.maor_memorygame I/art: Starting a blocking GC Alloc
  2020-01-19 15:20:06.415 1139-1139/com.example.maor_memorygame I/art: Alloc concurrent mark sweep GC freed 3(72B) AllocSpace objects, 0(0B) LOS objects, 37% free, 6MB/10MB, paused 1.547ms total 16.002ms
  2020-01-19 15:20:06.415 1139-1139/com.example.maor_memorygame W/art: Throwing OutOfMemoryError "Failed to allocate a 406425612 byte allocation with 4194304 free bytes and 377MB until OOM"
  2020-01-19 15:20:06.415 1139-1139/com.example.maor_memorygame I/art: Starting a blocking GC Alloc
  2020-01-19 15:20:06.415 1139-1139/com.example.maor_memorygame I/art: Starting a blocking GC Alloc
  2020-01-19 15:20:06.425 1139-1139/com.example.maor_memorygame I/art: Alloc sticky concurrent mark sweep GC freed 4(752B) AllocSpace objects, 0(0B) LOS objects, 37% free, 6MB/10MB, paused 975us total 9.026ms
  2020-01-19 15:20:06.425 1139-1139/com.example.maor_memorygame I/art: Starting a blocking GC Alloc
  2020-01-19 15:20:06.440 1139-1139/com.example.maor_memorygame I/art: Alloc partial concurrent mark sweep GC freed 6(144B) AllocSpace objects, 0(0B) LOS objects, 37% free, 6MB/10MB, paused 1.719ms total 14.523ms
  2020-01-19 15:20:06.440 1139-1139/com.example.maor_memorygame I/art: Starting a blocking GC Alloc
  2020-01-19 15:20:06.458 1139-1139/com.example.maor_memorygame I/art: Alloc concurrent mark sweep GC freed 3(72B) AllocSpace objects, 0(0B) LOS objects, 37% free, 6MB/10MB, paused 1.054ms total 17.991ms
  2020-01-19 15:20:06.458 1139-1139/com.example.maor_memorygame I/art: Forcing collection of SoftReferences for 387MB allocation
  2020-01-19 15:20:06.458 1139-1139/com.example.maor_memorygame I/art: Starting a blocking GC Alloc
  2020-01-19 15:20:06.476 1139-1139/com.example.maor_memorygame I/art: Alloc concurrent mark sweep GC freed 3(72B) AllocSpace objects, 0(0B) LOS objects, 37% free, 6MB/10MB, paused 2.155ms total 17.667ms
  2020-01-19 15:20:06.476 1139-1139/com.example.maor_memorygame W/art: Throwing OutOfMemoryError "Failed to allocate a 406425612 byte allocation with 4194304 free bytes and 377MB until OOM"
  2020-01-19 15:20:06.477 1139-1139/com.example.maor_memorygame D/skia: --- allocation failed for scaled bitmap
  2020-01-19 15:20:06.480 1139-1139/com.example.maor_memorygame D/AndroidRuntime: Shutting down VM
  2020-01-19 15:20:06.482 1139-1139/com.example.maor_memorygame E/AndroidRuntime: FATAL EXCEPTION: main
      Process: com.example.maor_memorygame, PID: 1139
      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.maor_memorygame/com.example.maor_memorygame.MainActivity}: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class &lt;unknown&gt;
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
          at android.app.ActivityThread.-wrap12(ActivityThread.java)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
          at android.os.Handler.dispatchMessage(Handler.java:102)
          at android.os.Looper.loop(Looper.java:154)
          at android.app.ActivityThread.main(ActivityThread.java:6119)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
       Caused by: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class &lt;unknown&gt;
       Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class &lt;unknown&gt;
       Caused by: java.lang.reflect.InvocationTargetException
          at java.lang.reflect.Constructor.newInstance0(Native Method)
          at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
          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:717)
          at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:785)
          at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
          at android.view.LayoutInflater.inflate(LayoutInflater.java:495)
          at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
          at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
          at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
          at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
          at com.example.maor_memorygame.MainActivity.onCreate(MainActivity.java:12)
          at android.app.Activity.performCreate(Activity.java:6679)
          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
          at android.app.ActivityThread.-wrap12(ActivityThread.java)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
          at android.os.Handler.dispatchMessage(Handler.java:102)
          at android.os.Looper.loop(Looper.java:154)
          at android.app.ActivityThread.main(ActivityThread.java:6119)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
       Caused by: java.lang.OutOfMemoryError: Failed to allocate a 406425612 byte allocation with 4194304 free bytes and 377MB until OOM
          at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
          at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
          at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:620)
          at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:455)
          at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1155)
          at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:720)
          at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:571)
          at android.content.res.Resources.loadDrawable(Resources.java:858)
          at android.content.res.TypedArray.getDrawable(TypedArray.java:928)
          at android.view.View.&lt;init&gt;(View.java:4202)
          at android.view.ViewGroup.&lt;init&gt;(ViewGroup.java:579)
          at android.widget.LinearLayout.&lt;init&gt;(LinearLayout.java:211)
  2020-01-19 15:20:06.482 1139-1139/com.example.maor_memorygame E/AndroidRuntime:     at android.widget.LinearLayout.&lt;init&gt;(LinearLayout.java:207)
          at android.widget.LinearLayout.&lt;init&gt;(LinearLayout.java:203)
              ... 25 more
  </code></pre>
  
  <p>app gradle.build:</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 29
      buildToolsVersion "29.0.2"
      defaultConfig {
          applicationId "com.example.maor_memorygame"
          minSdkVersion 21
          targetSdkVersion 29
          versionCode 1
          versionName "1.0"
          testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      implementation 'androidx.appcompat:appcompat:1.0.2'
      implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'androidx.test.ext:junit:1.1.0'
      androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
  }
  </code></pre>