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.

React Native 0.60.5 plugin configuration android

See original GitHub issue

Hi, while I was doing the setup of the library I found that in MainActivity.java there’s no more the onCreate method. MainActivity.java

package com.testApp;

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 "testApp";
    }
}

So I tried to do the setup in the getMainComponentName method: MainActivity.java

package com.testApp;

import com.facebook.react.ReactActivity;
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 String getMainComponentName() {
        SplashScreen.show(this);
        return "testApp";
    }
}

but when I try to compile it gives me this error: error: cannot find symbol variable SplashScreen

Anyone knows how to do it?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:10

github_iconTop GitHub Comments

6reactions
charmtigercommented, Sep 8, 2019

贴一个完整的供参考

MainActivity.java

package com.app;

import android.os.Bundle;

import com.facebook.react.ReactActivity;
// react navigation
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;

// react-native-splash-screen
import org.devio.rn.splashscreen.SplashScreen;
import com.facebook.soloader.SoLoader;

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 "app";
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        SoLoader.init(this, false);
        SplashScreen.show(this);
        super.onCreate(savedInstanceState);
    }

    /**
     * react navigation add
     */
    @Override
    protected ReactActivityDelegate createReactActivityDelegate() {
        return new ReactActivityDelegate(this, getMainComponentName()) {
            @Override
            protected ReactRootView createRootView() {
                return new RNGestureHandlerEnabledRootView(MainActivity.this);
            }
        };
    }
    
}

3reactions
MITDD6338commented, Sep 2, 2019

@jedashford Thank you now working 👍🏻😍

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-native-config - npm
Module to expose config variables to your javascript code in React Native, supporting iOS, Android and Windows.
Read more >
Upgrading to new versions - React Native
Upgrading to new versions of React Native will give you access to more APIs, views, developer tools and other goodies.
Read more >
React-Native 0.60+ with linked libs not running despite ...
I have an ejected react-native app with multiple linked libraries which fails to run in Android (works in iOS). The Dependency Graph loads ......
Read more >
Home - Documentation
Version 2.9.0 introduced a breaking change to the Android configuration. ... This SDK targets apps that are using React Native SDK version 0.60.5...
Read more >
React Native App - Automatic Setup - Flipper
Android - start the Flipper Desktop application and start your project using yarn android . Your application will appear in Flipper. · iOS...
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