I am using react-native
framework for developing my android app. I want to use react-native-material-design
library for making Toolbar
wit
npm start —–reset-cache
react-native run-android
One of the reasons why I was having this error was because I imported 'react-native' library twice.
import { View, Text, ActivityIndicator } from "react-native";
import { View, Text, ActivityIndicator, TouchableOpacity, StyleSheet } from "react-native";
I don't know If this can really cause this problem but removing the redundant line of import solved this issue for me.
1) You might work in Linux system & You have to run application with the terminal & check into the Android Simulator rather in Devices.
2)If you work with above then please make sure your Simulator Wifi should be off & then work with Studio It will work perfectly.
3)Make sure there should be not open multi-pal terminal or command window for at same time. if it then close one
First execute, to get the version number:
C:\WINDOWS\system32>react-native -v react-native-cli
2.0.1 react-native: 0.56.0
Then I uninstalled react-native:
C:\WINDOWS\system32>npm uninstall -g react-native-cli
removed 41 packages in 3.999s
Then I installed react-native:
npm install react-native@0.55.4
Then I installed react-native-cli:
npm install -g react-native-cli@1.2.0
Then use this installation to create a react-native project:
react-native init --version="0.55.4" myprojectname
I had the same issue with port 8081, change it to 8082. because its already being used by some other service here is step its work for me
First run your package server: Blockquote
react-native start --port 8082
Open another command prompt, start the Android app as usual:
react-native run-android
Once it finishes, now rewrite the tcp port that adb tunnels:
adb reverse tcp:8081 tcp:8082
See the list of adb tcp tunnels:
adb reverse --list
Now You should now see a message like:
(reverse) tcp:8081 tcp:8082
check your app it will run ...........!
As a newcomer to the React-native field, I used to face this error loads of times, and I always used to go confused. After a bit of experience though, I realized, it happens when the server tries to import something from a place which doesn't exist.
So checking what all you are importing and if that thing even exists, must be where you should start.
That means this error doesn't just pop up for an uninstalled package or so, but even if you are importing the wrong thing or from the wrong place.