Open mateoc10 opened 6 years ago
same exact issue here
ok solution is to add compile project(':react-native-splash-screen')
to android/app/build.gradle
automatic linking did not do that for me. should also check your android/settings.gradle for:
include ':react-native-splash-screen' project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')
as per manual installation instructions
I already have those lines. In iOS it works fine, but in android it fails when building
I was having the same issue. I ran
react-native run-android
And then from MainActivity.java in Android studio clicked gradle sync and it worked.
Ok so ive had this problem on several apps, my workaround is this (I dont know if it works with the latest it may do)
make sure you have uninstalled and unlinked, also delete .gradle in the app folder and also the splash-screen folder in node-modules (when unisntalling mine does not seem to delete this folder)
Then run npm i --save react-native-splash-screen@3.0.0
DO NOT LINK IT
Follow the manually linking instructions
using this import
MainApplication.java import com.cboy.rn.splashscreen.SplashScreenReactPackage;
MainActivity.java import com.cboy.rn.splashscreen.SplashScreenReactPackage;
Then link it manually in the settings.gradle
include ':react-native-splash-screen'
project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')
Also in the android/app/build.gradle
ensure it has this added in the dependencies
dependencies { compile project(':react-native-splash-screen') }
Hope this helps have banged my head against a brick wall with this on 3 occasions and forgot how I fixed it, so have it written down now.
@AphexIce So I have to install react-native-device-info ? I was not using that. After doing everything you said some errors left, but this one remained: symbol: class SplashScreenReactPackage /Users/mateocarranza/Documents/Tesis/WannagiveApp/android/app/src/main/java/com/wannagiveapp/MainActivity.java:27: error: cannot find symbol SplashScreen.show(this); ^
O dear my error I have updated my code now it should be
dependencies { compile project(':react-native-splash-screen') }
I have mine working perfectly now with the latest version of react and splash-screen 3.0.0 the best thing really is to clean it all out as described above, then delete .gradle and do a gradlew clean then install and link it again using splash-screen 3.0.0
I had the issue as not having imported, but it was used in the onCreate.
import android.os.Bundle;
/Users/mateocarranza/Documents/Tesis/WannagiveApp/android/app/src/main/java/com/wannagiveapp/MainApplication.java:22: error: package org.devio.rn.splashscreen does not exist import org.devio.rn.splashscreen.SplashScreenReactPackage; ^ /Users/mateocarranza/Documents/Tesis/WannagiveApp/android/app/src/main/java/com/wannagiveapp/MainActivity.java:5: error: package org.devio.rn.splashscreen does not exist import org.devio.rn.splashscreen.SplashScreen; ^ /Users/mateocarranza/Documents/Tesis/WannagiveApp/android/app/src/main/java/com/wannagiveapp/MainApplication.java:51: error: cannot find symbol new SplashScreenReactPackage() ^ symbol: class SplashScreenReactPackage /Users/mateocarranza/Documents/Tesis/WannagiveApp/android/app/src/main/java/com/wannagiveapp/MainActivity.java:27: error: cannot find symbol SplashScreen.show(this); // here ^ symbol: variable SplashScreen location: class MainActivity 4 errors Incremental compilation of 2 classes completed in 0.749 secs. :app:compileDebugJavaWithJavac FAILED
"react-native": "^0.46.4", "react-native-splash-screen": "^2.1.0",
please help, in iOS it works fine