title: Android app crashed if the main activity isn't MainActivity
body: <p>I want to start with the Loading view but always crashed when I open it if the main activity in AndroidManifiest.xml isn't MainActivity. On the emulator is fine but the problem only is when install the apk in a phone. Any help?</p>
  
  <p>AndroidManifiest.xml</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.example.daniel.jaentodayapp"&gt;
  &lt;application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label=""
      android:supportsRtl="true"
      android:theme="@style/AppTheme"&gt;
      &lt;activity
          android:name=".MainActivity"
          android:screenOrientation="portrait"
          android:theme="@style/AppTheme.NoActionBar"&gt;
      &lt;/activity&gt;
      &lt;activity
          android:name=".LoadingScreen"
          android:screenOrientation="portrait"
          android:theme="@style/AppTheme.NoActionBar"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p></p>
  
  <p>LoadingScreen</p>
  
  <pre><code>public class LoadingScreen extends AppCompatActivity {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_loading_screen);
      new Thread(new Runnable() {
          public void run() {
              try {
                  Thread.sleep(3000);
              } catch (InterruptedException e) {
                  e.printStackTrace();
              } finally {
                  Intent intent = new Intent(LoadingScreen.this, MainActivity.class);
                  startActivity(intent);
              }
          }
      }).start();
  }
  
  @Override
  protected void onPause() {
      super.onPause();
      finish();
  }}
  </code></pre>
  
  <p>Layout Loading Screen</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:id="@+id/activity_loading_screen"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context="com.example.daniel.jaentodayapp.LoadingScreen"&gt;
  &lt;LinearLayout
      android:orientation="horizontal"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@drawable/pcarga"&gt;&lt;/LinearLayout&gt;&lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>This is the error:</p>
  
  <pre><code>E/AndroidRuntime: FATAL EXCEPTION: main
                Process: com.example.daniel.jaentodayapp, PID: 18967
                java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.daniel.jaentodayapp/com.example.daniel.jaentodayapp.LoadingScreen}: android.view.InflateException: Binary XML file line #9: Binary XML file line #9: 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.access$900(ActivityThread.java:150)
                    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 #9: Binary XML file line #9: 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.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
                    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                    at com.example.daniel.jaentodayapp.LoadingScreen.onCreate(LoadingScreen.java:13)
                    at android.app.Activity.performCreate(Activity.java:6285)
                    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                    at android.app.ActivityThread.access$900(ActivityThread.java:150) 
                    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 #9: 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.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284) 
                    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                    at com.example.daniel.jaentodayapp.LoadingScreen.onCreate(LoadingScreen.java:13) 
                    at android.app.Activity.performCreate(Activity.java:6285) 
                    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) 
                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                    at android.app.ActivityThread.access$900(ActivityThread.java:150) 
                    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.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284) 
                    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                    at com.example.daniel.jaentodayapp.LoadingScreen.onCreate(LoadingScreen.java:13) 
                    at android.app.Activity.performCreate(Activity.java:6285) 
                    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) 
                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                    at android.app.ActivityThread.access$900(ActivityThread.java:150) 
                    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 255322380 byte allocation with 12571568 free bytes and 126MB 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:3955)
                    at android.view.ViewGroup.&lt;init&gt;(ViewGroup.java:574)
                    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.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284) 
                    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                    at com.example.daniel.jaentodayapp.LoadingScreen.onCreate(LoadingScreen.java:13) 
                    at android.app.Activity.performCreate(Activity.java:6285) 
                    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) 
                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                    at android.app.ActivityThread.access$900(ActivityThread.java:150) 
                    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) 
  </code></pre>