Android application takes too much time to start?
<p>I'm finished with android app. Used firebase, admob. Has 31 activities. But when user installs the app for first time, the launch time is approximately 18 seconds which is too high. After first time launching, signup activity is there. But if we relaunch the app then it launches in 2 seconds. Why there is very high launch time? How can I reduce it? Below is my Sign up activity code. Using android studio 2.2</p>

<pre><code>public class MainActivity extends AppCompatActivity {
private AdView mAdView;
private SignInButton mGoogleBtn;
private static final int RC_SIGN_IN=1;
private GoogleApiClient mGoogleApiClient;
private FirebaseAuth mAuth;
private static final String TAG="MAIN_ACTIVITY";
private FirebaseAuth.AuthStateListener mAuthListener;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mAuth=FirebaseAuth.getInstance();
    mAuthListener=new FirebaseAuth.AuthStateListener() {
        @Override
        public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
            if(firebaseAuth.getCurrentUser()!=null){
                startActivity(new Intent(MainActivity.this,Home.class));

            }
        }
    };
    mGoogleBtn=(SignInButton)findViewById(R.id.view);
    // Configure Google Sign In
    GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestIdToken(getString(R.string.default_web_client_id))
            .requestEmail()
            .build();

    mGoogleApiClient=new GoogleApiClient.Builder(getApplicationContext())
            .enableAutoManage(this, new GoogleApiClient.OnConnectionFailedListener() {
                @Override
                public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
                    Toast.makeText(MainActivity.this,"Login via Google Failed! Press Skip",Toast.LENGTH_LONG).show();

                }
            })
            .addApi(Auth.GOOGLE_SIGN_IN_API,gso)
            .build();
    mGoogleBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            signIn();
        }
    });
}

@Override
protected void onStart() {
    super.onStart();
    mAuth.addAuthStateListener(mAuthListener);
}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
    if (requestCode == RC_SIGN_IN) {
        GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
        if (result.isSuccess()) {
            // Google Sign In was successful, authenticate with Firebase

            GoogleSignInAccount account = result.getSignInAccount();
            firebaseAuthWithGoogle(account);
        } else {
            // Google Sign In failed, update UI appropriately
            // ...
        }
    }
}


private void firebaseAuthWithGoogle(GoogleSignInAccount account) {
    Log.d(TAG, "firebaseAuthWithGoogle:" + account.getId());

    AuthCredential credential = GoogleAuthProvider.getCredential(account.getIdToken(), null);
    mAuth.signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener&lt;AuthResult&gt;() {
                @Override
                public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
                    Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());

                    // If sign in fails, display a message to the user. If sign in succeeds
                    // the auth state listener will be notified and logic to handle the
                    // signed in user can be handled in the listener.
                    if (!task.isSuccessful()) {
                        Log.w(TAG, "signInWithCredential", task.getException());
                        Toast.makeText(MainActivity.this, "Authentication failed. Press Skip.",
                                Toast.LENGTH_SHORT).show();
                    }
                    else {
                        Toast.makeText(MainActivity.this,"Login Successful! Welcome to Unipune Buddy!",Toast.LENGTH_LONG).show();

                    }
                    // ...
                }
            });
}




private void signIn() {
    Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
    startActivityForResult(signInIntent, RC_SIGN_IN);
}

public void mainscreen(View view){
    Intent intent0=new Intent(this,Home.class);
    Toast.makeText(MainActivity.this,"Signed in Successfully!",Toast.LENGTH_LONG).show();
    startActivity(intent0);
}
}
</code></pre>