Open MonAiss opened 5 years ago
i found out where is the problem by myself, if you had the same problem just remove that line in "MainApplication.java" and "MainActivity.java":
import com.cboy.rn.splashscreen.SplashScreenReactPackage;
According to @crazycodeboy React Native Splash Screen Documentation:
import android.os.Bundle; // here
import com.facebook.react.ReactActivity;
// react-native-splash-screen >= 0.3.1
import org.devio.rn.splashscreen.SplashScreen; // here
// react-native-splash-screen < 0.3.1
import com.cboy.rn.splashscreen.SplashScreen; // here
So it means, if you use react-native-splash-screen >= 0.3.1. Then use:
import org.devio.rn.splashscreen.SplashScreen;
But if you use react-native-splash-screen < 0.3.1. Then use:
import com.cboy.rn.splashscreen.SplashScreen;
According to @crazycodeboy React Native Splash Screen Documentation:
import android.os.Bundle; // here import com.facebook.react.ReactActivity; // react-native-splash-screen >= 0.3.1 import org.devio.rn.splashscreen.SplashScreen; // here // react-native-splash-screen < 0.3.1 import com.cboy.rn.splashscreen.SplashScreen; // here
So it means, if you use react-native-splash-screen >= 0.3.1. Then use:
import org.devio.rn.splashscreen.SplashScreen;
But if you use react-native-splash-screen < 0.3.1. Then use:
import com.cboy.rn.splashscreen.SplashScreen;
thanks
Run
react-native info
in your project and share the content. react-native info info React Native Environment Info: System: OS: Windows 7 CPU: (4) x64 Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz Memory: 879.25 MB / 3.87 GB Binaries: Yarn: 1.12.3 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 6.5.0 - C:\Program Files\nodejs\npm.CMD IDEs: Android Studio: Version 3.2.0.0 AI-181.5540.7.32.5056338What
react-native-splash-screen
version are you using? react-native-splash-screen >= 0.3.1What platform does your issue occur on? (Android/iOS/Both) Android
Describe your issue as precisely as possible : 1) Steps to reproduce the issue or to explain in which case you get the issue First step(Download): -npm i react-native-splash-screen --save Second step(Plugin Installation): -react-native link react-native-splash-screen Third step(Plugin Configuration): -Android:
Update the MainActivity.java to use react-native-splash-screen via the following changes:
import android.os.Bundle; // here import com.facebook.react.ReactActivity; // react-native-splash-screen >= 0.3.1 import org.devio.rn.splashscreen.SplashScreen; // here // react-native-splash-screen < 0.3.1 import com.cboy.rn.splashscreen.SplashScreen; // here
public class MainActivity extends ReactActivity { @Override protected void onCreate(Bundle savedInstanceState) { SplashScreen.show(this); // here super.onCreate(savedInstanceState); } // ...other code } -iOS:
Update AppDelegate.m with the following additions:
import "AppDelegate.h"
import <React/RCTBundleURLProvider.h>
import <React/RCTRootView.h>
import "RNSplashScreen.h" // here
@implementation AppDelegate
(BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary )launchOptions { // ...other code
[RNSplashScreen show]; // here // or //[RNSplashScreen showSplash:@"LaunchScreen" inRootView:rootView]; return YES; }
@end Getting started Import react-native-splash-screen in your JS file.
import SplashScreen from 'react-native-splash-screen'
Android: Create a file called launch_screen.xml in app/src/main/res/layout (create the layout-folder if it doesn't exist). The contents of the file should be the following:
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
Customize your launch screen by creating a launch_screen.png-file and placing it in an appropriate drawable-folder. Android automatically scales drawable, so you do not necessarily need to provide images for all phone densities. You can create splash screens in the following folders:
drawable-ldpi drawable-mdpi drawable-hdpi drawable-xhdpi drawable-xxhdpi drawable-xxxhdpi Add a color called primary_dark in app/src/main/res/values/colors.xml
<?xml version="1.0" encoding="utf-8"?>
Optional steps:
If you want the splash screen to be transparent, follow these steps.
Open android/app/src/main/res/values/styles.xml and add- true
to the file. It should look like this:
Join a screenshot or video of the problem on the simulator or device?
Show us the code you are using? react-native run-android info Starting JS server... info Building and installing the app on the device (cd android && gradlew.bat ap p:installDebug)...
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:comm and_line_warnings
BUILD FAILED in 10s 52 actionable tasks: 1 executed, 51 up-to-date error Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/getting-started.html error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag