question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onCreate method does not exist in MainActivity.java

See original GitHub issue

The onCreate method does not exists in MainActivity.java and after creating it as described in documentation, the app wont open and crashes.

What I’m using: “react-native”: “0.66.4”, “react-native-splash-screen”: “^3.3.0”,

The Platform: Android

`package com.app;

import android.os.Bundle; import com.facebook.react.ReactActivity;

// react-native-splash-screen >= 0.3.1 import org.devio.rn.splashscreen.SplashScreen;

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 void onCreate(Bundle savedInstanceState) { SplashScreen.show(this); // rn splash screen

    super.onCreate(savedInstanceState); }

@Override protected String getMainComponentName() { return “Admin”; } }`

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:8

github_iconTop GitHub Comments

6reactions
kameshkumar786commented, Mar 19, 2022

please add this line in MainActivvity.java

import android.os.Bundle;

4reactions
vasschercommented, Jun 1, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

onCreate() not found in MainActivity.java - react native
Based on the doc, I need to initialize it in onCreate() method but there is no such method found in my MainActivity.java ....
Read more >
MainActivity.java, Java - rextester
onCreate(savedInstanceState); ^ symbol: variable super location: class MainActivity source_file.java:19: error: package R does not exist ...
Read more >
onCreate(Bundle savedInstanceState) Function in Android
First create a new project, name it Exampleoncreate and create a activity name MainActivity. Also create a content_main.xml in layout if not present...
Read more >
MainActivity.java—Overriding Method onCreate of Class Activity
MainActivity.java—Overriding Method onCreate of Class Activity ... Get Android App Development Fundamentals I and II LiveLessons (Video Training) now with the O' ...
Read more >
Service | Android Developers
The Service object itself does not imply it is running in its own process; ... will retrieve the service (creating it and calling...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found