crazycodeboy / react-native-splash-screen

A splash screen for react-native, hide when application loaded ,it works on iOS and Android.
MIT License
5.61k stars 1.09k forks source link

no suitable method found for show(MainActivity,boolean,int) #147

Open francisrod01 opened 6 years ago

francisrod01 commented 6 years ago

I followed the implementation for android platform showed on README.md file.

Environment:

OS: Linux 3.16 Node: 9.3.0 Yarn: 1.3.2 npm: 5.5.1 Watchman: 4.9.0 Xcode: N/A Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)

react: 16.0.0 => 16.0.0 react-native: 0.51.0 => 0.51.0

version of react-native-splash-screen

{ name: 'react-native-splash-screen',
  description: 'A splash screen for react-native, hide when application loaded ,it works on iOS and Android.',
  'dist-tags': 
   { latest: '3.0.6' }
}

MainActivity.java

import android.os.Bundle;

import com.facebook.react.ReactActivity;
import org.devio.rn.splashscreen.SplashScreen;

public class MainActivity extends ReactActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // here show splash screen
        SplashScreen.show(this, false, R.style.SplashScreenTheme);
        super.onCreate(savedInstanceState);
    }
...

compiling...

~$ export ENVFILE=.env.dev && react-native bundle --platform android --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res && react-native run-android

and output below:

/android/app/src/main/java/com/adm/panel/MainActivity.java:13: error: no suitable method found for show(MainActivity,boolean,int)
        SplashScreen.show(this, false, R.style.SplashScreenTheme);
                    ^
    method SplashScreen.show(Activity,boolean) is not applicable
      (actual and formal argument lists differ in length)
    method SplashScreen.show(Activity) is not applicable
      (actual and formal argument lists differ in length)
1 error
:app:compileDebugJavaWithJavac FAILED

But in my colors.xml SplashScreenTheme exists.

colors.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="status_bar_color">#2e2f2e</color>

    <style name="SplashScreenTheme" parent="SplashScreen_SplashTheme">
        <item name="colorPrimaryDark">@color/status_bar_color</item>
    </style>
</resources>

styles.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="android:windowIsTranslucent">true</item>
    </style>

</resources>
zim-lee commented 6 years ago

I have the same problem

imranolas commented 6 years ago

This feature whilst documented on master hasn't yet been released in v3.0.6. If you need to use it consider adding the following to your package.json dependencies.

"react-native-splash-screen": "crazycodeboy/react-native-splash-screen#ddca267"
zim-lee commented 6 years ago

@imranolas yeah, I found it, thanks

elkinjosetm commented 6 years ago

Same problem here, please release it properly. I was able to install the latest by straight up installing master.

rimiti commented 6 years ago

Up !

koloff commented 6 years ago

up

willbattel commented 6 years ago

I'm still getting this error on 3.0.7, which is weird because it should include the changes on master. I still have to pull straight from git to get this to work.

What gives?

palkerecsenyi commented 5 years ago

Still getting this error on 3.2.0

cluis13915 commented 4 years ago

Getting similar error on 3.2.0

error: no suitable method found for show(<anonymous ReactActivityDelegate>,int)

Got from MainActivity:

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

            @Override
            protected void onCreate(Bundle savedInstanceState) {
                SplashScreen.show(this, R.style.SplashScreenTheme);
                super.onCreate(savedInstanceState);
            }
        };
    }