Open XEmAX32 opened 5 years ago
Ours is working with this on 0.60.5:
import org.devio.rn.splashscreen.SplashScreen;
public class MainActivity extends GoogleCastActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
SoLoader.init(this, false);
SplashScreen.show(this, R.style.SplashTheme); // here
super.onCreate(savedInstanceState);
}
}```
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); // here
super.onCreate(savedInstanceState);
}
protected String getMainComponentName() {
SplashScreen.show(this); // here
return "splash";
}
}
i wrote this was still not working
My package.json: "react-native": "^0.60.5" "react-native-splash-screen": "^3.2.0"
Then I follow exactly the latest docs (don't change or add/remove extra anything) and the library works fine on both iOS and Android
Maybe you try to unlink, uninstall this library, remove cache, build... and do it again.
.../android/app/src/main/java/com/receiptsnap/MainActivity.java:9: error: cannot find symbol SoLoader.init(this, false); ^ symbol: variable SoLoader location: class MainActivity .../android/app/src/main/java/com/receiptsnap/MainActivity.java:10: error: cannot find symbol SplashScreen.show(this, R.style.SplashTheme); // here ^ symbol: variable SplashTheme location: class style 2 errors
FAILURE: Build failed with an exception.
@jedashford Still In android is not Working I get this error
I have the same Issue , how did you resolve it @hussainhspl
53 actionable tasks: 2 executed, 51 up-to-date
.../android/app/src/main/java/com/receiptsnap/MainActivity.java:9: error: cannot find symbol SoLoader.init(this, false); ^ symbol: variable SoLoader location: class MainActivity .../android/app/src/main/java/com/receiptsnap/MainActivity.java:10: error: cannot find symbol SplashScreen.show(this, R.style.SplashTheme); // here ^ symbol: variable SplashTheme location: class style 2 errors
FAILURE: Build failed with an exception.
@jedashford Still In android is not Working I get this error
You may need to add the import statement at the top of the file:
import org.devio.rn.splashscreen.SplashScreen;
import com.facebook.soloader.SoLoader;
@jedashford Thank you now working 👍🏻😍
贴一个完整的供参考
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);
}
};
}
}
@hussainhspl Remove SplashScreen.show(this);
from protected String getMainComponentName()
To fix this Error add this import to the top:
import android.os.Bundle;
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
So I tried to do the setup in the getMainComponentName method: MainActivity.java
but when I try to compile it gives me this error:
error: cannot find symbol variable SplashScreen
Anyone knows how to do it?