React-Native: Application has not been registered error

后端 未结 23 1943
無奈伤痛
無奈伤痛 2020-12-22 18:55

I am currently going through the React-Native tutorials. I began with the Getting Started tutorial, where I made a new react native project and successfully managed to run t

相关标签:
23条回答
  • 2020-12-22 19:21

    I figured out where the problem was in my case (Windows 10 OS), but It might also help in Linux as well( You might try).

    In windows power shell, when you want to run an app(first time after pc boot) by executing the following command,

    react-native run-android
    

    It starts a node process/JS server in another console panel, and you don't encounter this error. But, when you want to run another app, you must need to close that already running JS server console panel. And then execute the same command for another app from the power shell, that command will automatically start another new JS server for this app, and you won't encounter this error.

    You don't need to close and reopen power shell for running another app, you need to close node console to run another app.

    0 讨论(0)
  • 2020-12-22 19:21

    My issue was that in AndroidManifest.xml and MainActivity.java package names were different. So in manifest I had package=com.companyName.appName and in activity package com.appName

    0 讨论(0)
  • 2020-12-22 19:22

    In my case there's this line in MainActivity.java which was missed when I used react-native-rename cli (from NPM)

    protected String getMainComponentName() {
        return "AwesomeApp";
    }
    

    Obviously ya gotta rename it to your app's name.

    0 讨论(0)
  • 2020-12-22 19:22

    Non of the solutions worked for me. I had to kill the following process and re ran react-native run-android and it worked.

    node ./local-cli/cli.js start

    0 讨论(0)
  • 2020-12-22 19:24

    In my case i have got a different solution in case any one need

    yarn remove react-native-material-dropdown
    

    Install new packages react-native-material-dropdown-v2

    yarn add react-native-material-dropdown-v2
    

    Replace react-native-material-dropdown with react-native-material-dropdown-v2 in your code

    e.g. import { Dropdown } from 'react-native-material-dropdown' to import { Dropdown } from 'react-native-material-dropdown-v2'

    another thing ==========

    1. Open node_modules and then search for react-native-material-textfield open the file and go to src folder
    2. Under src you will see affix, helper, label folder - under each folder, there is an index.js
    3. open the index.js of the mentioned folders one by one (all 3 folders) and search for the text style: Animated.Text.propTypes.style, and replace it by style: Text.propTypes
    4. And import text form react-native like this import { Animated , Text} from 'react-native';
    0 讨论(0)
提交回复
热议问题