Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native - Splash Screen Changing Error

Hi I used This Article to Changing my Splash Screen for android via react native But I Got This Error: Article link

  BUILD SUCCESSFUL  
Total time: 1 mins 43.179 secs
Running C:\Users\Saeed\AppData\Local\Android\sdk/platform-tools/adb -s 5203fc0e586a3409 reverse tcp:8081 tcp:8081
Starting the app on 5203fc0e586a3409 (C:\Users\Saeed\AppData\Local\Android\sdk/platform-tools/adb -s 5203fc0e586a3409 shell am start -n com.mohajerkade/.MainActivity)...
Starting: Intent { cmp=com.mohajerkade/.MainActivity VirtualScreenParam=Params{mDisplayId=-1, null, mFlags=0x00000000)} }
Error type 3
Error: Activity class {com.mohajerkade/com.mohajerkade.MainActivity} does not exist.
events.js:160
      throw er; // Unhandled 'error' event
      ^
Error: spawn cmd.exe ENOENT
    at exports._errnoException (util.js:1022:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:359:16)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

First I have Splash Screen for 3 secend and After that** I got a red Screen Error calling AppRegistry.runApplication in my mobile** and Can't See React Native Hello World

This is my MainActivity.java :

package com.mohajerkade;

import com.facebook.react.ReactActivity;

public class MainActivity extends ReactActivity {

    /**
     * Returns the name of the main component registered from JavaScript.
     * This is used to schedule rendering of the component.
     */
    @Override
    protected String getMainComponentName() {
        return "Mohajerkade";
    }
}

and This is SplashActivity.java :

    package com.mohajerkade;

import com.facebook.react.ReactActivity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

public class SplashActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Intent intent = new Intent(this, MainActivity.class);
        startActivity(intent);
        finish();
    }
}

I Used This Toturial But I Don't Know How Should I See Splash Screen In application loading and after that react native Hello World.

like image 698
Saeed Heidarizarei Avatar asked Mar 10 '26 20:03

Saeed Heidarizarei


1 Answers

start it fresh, Lets go step by step.

  • delete previous app from your phone
  • start the server (react-native start)
  • press run button from your android studio
  • after that from your app open the developer's menu
  • set your localhost(IP address:8081) by going to the option Debug server host for device.
  • Reload and you are good to go.

Note:

If the phone is connected through USB then connect your system and phone with same wifi, else run adb reverse tcp:8081 tcp:8081

Cheers :)

like image 198
Codesingh Avatar answered Mar 13 '26 09:03

Codesingh