React-native-splash-screen: Android build error. MainActivity.java:7: error: cannot find symbol - onCreate(Bundle savedInstanceState)

Created on 15 Oct 2017  Â·  8Comments  Â·  Source: crazycodeboy/react-native-splash-screen

"react": "16.0.0-alpha.12",
"react-native": "0.47.0",
"react-native-splash-screen": "^3.0.1"
Build console:
screen shot 2017-10-15 at 14 57 01
MainActivity.java;
screen shot 2017-10-15 at 14 58 08

Most helpful comment

@jnranawedo in my case, I wasn't including Bundle in android/app/src/main/java/com/<myapp>/MainActivity.java.

I solved the issue by adding these lines to the top of MainActivity.java:

import android.os.Bundle; // required for onCreate parameter
import org.devio.rn.splashscreen.SplashScreen; // required for react-native-splash-screen >= 0.3.1

All 8 comments

@brkrtp I'm experiencing the same error. The link in your latest comment is broken for me (404). What did you do to fix the issue?

Hello, Have you found any solution for this ?

@jnranawedo in my case, I wasn't including Bundle in android/app/src/main/java/com/<myapp>/MainActivity.java.

I solved the issue by adding these lines to the top of MainActivity.java:

import android.os.Bundle; // required for onCreate parameter
import org.devio.rn.splashscreen.SplashScreen; // required for react-native-splash-screen >= 0.3.1

this might help you
MainActivity.java

import android.os.Bundle;
import com.facebook.react.ReactActivity;
import com.cboy.rn.splashscreen.SplashScreen;

public class MainActivity extends ReactActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this); // here
super.onCreate(savedInstanceState);
}
// ...other code
}

@brandonjyuhas solution worked but shouldnt this be in the docs?
Or did i miss it?

Yes, how is this not in the docs (still!)?

Yes it's Working
Just Add the this line given that document.

MainActivity.java file

"import android.os.Bundle;"

Thankyou...

Was this page helpful?
0 / 5 - 0 ratings