in android/app/build.gradle
dependencies {
compile project(':react-native-splash-screen')
}
in android/app/src/main/java/com/[projectName]/MainApplication.java
import org.devio.rn.splashscreen.SplashScreenReactPackage;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new SplashScreenReactPackage() //here
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
}
whenever i add these code, the build for android get failed and gives these error.
i'm using react-native-splash-screen package for the splashscreen in both iOS and android. It works well with iOS, the build failed is only on android.
Update android/build.gradle
allprojects {
repositories {
mavenLocal()
jcenter()
// Add ===========================
maven {
url 'https://maven.google.com'
}
// ===============================
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.