Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 29741

Invariant Violation: WebView has been removed from React Native

$
0
0

I am trying to run a 2 years oldreact-native project. When I run my project, it showing the error

Invariant Violation: WebView has been removed from React Native. It can now be installed and imported from'react-native-webview' instead of 'react-native'. See https://github.com/react-native-community/react-native-webview

and

Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)

but I haven't installed or used any package named react-native-webview or webview and I have updated all gradle files and the dependencies in package.json to the current versions

my package.json

"dependencies": {
    "@react-native-community/async-storage": "^1.8.1",
    "axios": "^0.19.2",
    "native-base": "^2.13.8",
    "react": "^16.13.0",
    "react-native": "^0.61.5",
    "react-native-android-location-services-dialog-box": "^2.8.2",
    "react-native-drawer": "^2.5.1",
    "react-native-fetch-blob": "^0.10.8",
    "react-native-firebase": "^5.6.0",
    "react-native-geocoding": "^0.4.0",
    "react-native-gesture-handler": "^1.6.0",
    "react-native-google-places-autocomplete": "^1.4.1",
    "react-native-image-picker": "^2.3.1",
    "react-native-loading-spinner-overlay": "^1.1.0",
    "react-native-maps": "^0.26.1",
    "react-native-paper": "^3.6.0",
    "react-native-permissions": "^2.0.9",
    "react-native-push-notification": "^3.1.9",
    "react-native-qrcode": "^0.2.7",
    "react-native-spinkit": "^1.5.0",
    "react-native-swiper": "^1.5.14",
    "react-native-switch": "^1.5.0",
    "react-navigation": "^4.2.2",
    "react-navigation-material-bottom-tabs": "^2.2.2",
    "react-redux": "^7.2.0",
    "redux": "^4.0.5",
    "redux-promise": "^0.6.0",
    "redux-saga": "^1.1.3",
    "toggle-switch-react-native": "^2.1.0"
  },

settings.gradle

rootProject.name = 'revamp_alpha_consumer'
    include ':react-native-spinkit'
    project(':react-native-spinkit').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-spinkit/android')
    include ':react-native-push-notification'
    project(':react-native-push-notification').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-push-notification/android')
    include ':react-native-maps'
    project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')
    include ':react-native-image-picker'
    project(':react-native-image-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-picker/android')
    include ':react-native-gesture-handler'
    project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
    include ':react-native-firebase'
    project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')
    include ':react-native-fetch-blob'
    project(':react-native-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fetch-blob/android')
    include ':react-native-android-location-services-dialog-box'
    project(':react-native-android-location-services-dialog-box').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-android-location-services-dialog-box/android')
    include ':@react-native-community_async-storage'
    project(':@react-native-community_async-storage').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/async-storage/android')
    apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

    include ':app'

android/app/build.gradle

dependencies {

    implementation project(':react-native-spinkit')
    implementation project(':react-native-push-notification')
    implementation project(':react-native-maps')
    implementation project(':react-native-image-picker')
    implementation project(':react-native-gesture-handler')
    implementation project(':react-native-firebase')
    implementation project(':react-native-fetch-blob')
    implementation project(':react-native-android-location-services-dialog-box')
    implementation project(':@react-native-community_async-storage')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-native:+"  // From node_modules

    implementation "com.google.android.gms:play-services-base:16.1.0"
    implementation "com.google.firebase:firebase-core:16.0.9"
    implementation "com.google.firebase:firebase-messaging:18.0.0"

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

android/build.gradle

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28

        supportLibVersion = "28.0.0"
        googlePlayServicesVersion = "16.1.0" // default: "+"
        firebaseVersion = "17.3.4" // default: "+"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.4.2")
        classpath 'com.google.gms:google-services:4.3.3'
    }
}
allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}

index.js

import React from 'react';
import { AppRegistry } from 'react-native';
import { name as appName } from './app.json';
import bgMessaging from './components/bgMessaging';
import Root from './Root';

// YellowBox.ignoreWarnings(['Warning: isMounted(...) is deprecated', 'Module RCTImageLoader']);
// AppRegistry.registerComponent('Alpharevamp', () => Root);

AppRegistry.registerComponent(appName, () => Root);
AppRegistry.registerHeadlessTask('RNFirebaseBackgroundMessage', () => bgMessaging); // <-- Add this line

I have tried to run it after install the 'react-native-webview' package and add its dependencies (no where used, only installed for check whether the error subsides). But the same error occurred.

error in browsererror in mobile screen


Viewing all articles
Browse latest Browse all 29741

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>