I'm having trouble in installing react native vector icon
after installing
I followed with gradle option
just add the lines in android/app/build.gradle like this in the end of the file like following:
and getting this error after react-native run-android
The guide in their repo is outdated. After you do the npm install you need to run react-native link.
See the doc section
Related
when I tried to run the react native project on android by command npm run android
I got this error:
The android project not found. Are you sure this is a React Native project? If your Android files are located in a non-standard location (e.g. not inside the 'android' folder), consider setting project.android.sourceDir option to point to a new location.info Run CLI with --verbose flag for more details.
To resolve the issue please upgrade the react-native package.
Go to the Project root.
Upgrade the React native package in the Command Prompt by typing react-native upgrade
Then Accept to update all the Files by typing y (Yes) in the Command Prompt.
Reference: https://github.com/facebook/react-native/issues/9312
and also use the command : npx react-native run-android
I'm using react-native-gesture-handler within react-navigation and getting this error
null is not an object ( evaluating 'RNGestureHandlerModule.Direction')
Workspace file is automatically created with new React native version(0.60). And there is no libraries under libraries folder in Xcode project.
I created new project in react native and new project created with react-native version 0.60 automatically. Then I installed following dependencies
npm install —save react-navigation
npm install —save react-native-gesture-handler
After installing I am getting runtime error
null is not an object ( evaluating 'RNGestureHandlerModule.Direction')
I also tried to manually link react-native-gesture-handler dependencies with following steps
Right Click Libraries "Add Files to Project"
/node_modules/react-native-gesture-handlers/ios/RNGestureHandler.xcodeproj
Go to build phases and add libRNGestureHandler.a
Run
After that I am getting following errors
-> File not found
-> File not found
Any suggestion for me to fix this?
Did you try using react-native link react-native-gesture-handler?
For me the solution was:
1) react-native link react-native-gesture-handler
2) cd ios
3) pod install
as now, pod is installed automatically into the project with react-native 0.60
If you use RN > 0.60 you don't have to link react-native-gesture-handler manually as it supports autolinking.
For iOS
cd ios && pod install
For further info see issue #671
Please try to link react-native-gesture-handler then fixed this error
try this command for link gesture-handler pluggin
react-native link react-native-gesture-handler
When I follow the instruction by the react-navigation website : https://reactnavigation.org/docs/en/getting-started.html.
react-native link react-native-gesture-handler
and then change the MainActivity.java like it asks.
Then run react-native run-android, and error pop up :
error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
react-native-gesture-handler (to unlink run: "react-native unlink react-native-gesture-handler")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink " and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
my react-native version :
react-native-cli: 2.0.1
react-native: 0.60.0
However, when I follow the instruction, to unlink the library
use : react-native unlink react-native-gesture-handler
The app successfully built, but now it pops up another error in the app :
null is not an object (evaluating 'rngesturehandlermodule.direction')
I tried a lot of solution in a lot of websites, like
undefined is not an object (evaluating 'RNGestureHandlerModule.State'
non of them is working for me
Looks like this is to do with the new autolinking feature in RN 0.60.
For iOS
To fix for now just add the following podspec for RNGesureHandler to ios/Podfile
pod 'RNGestureHandler', :podspec => '../node_modules/react-native-gesture-handler/RNGestureHandler.podspec'
Then in the ios directory run pod install to install it.
For Android
Path: android/app/src/main/java/com/projectname/MainApplication.java
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
....
protected List<ReactPackage> getPackages() {
// Add additional packages you require here
// No need to add RnnPackage and MainReactPackage
return Arrays.<ReactPackage>asList(
....
new RNGestureHandlerPackage()
);
}
Have a good day.
I'm not sure about what went wrong, but very possibly because of the react-native-cli that upgraded from below 0.60.0 to above it.
BEFORE 0.60.0 when running react-native run-android, the command will run a metro packager, along with building the android app, and then run the app that connect to the metro packager.
That's why in the past, we only run one command "react-native run-android" to run the project.
But AFTER 0.60.0 when running react-native run-android, the command will only build the android-app, and run the app to connect to the metro packager.
I saw a command prompt blinked once, might also be how the command start the metro packager went wrong and the packager just closed itself somehow.
Also as for the problem with react-native link react-native-gesture-handler I believe it is the new feature of react-native 0.60.0 to autolink library, so manual linking of library is not necessary anymore. As a lot of the library provider might need to start providing auto-linking features, or might face the same error, not just react-native-gesture-handler.
Temporary Solution until someone fix the react-native-cli to run the metro packager again:
Open 2 command prompt instead of 1. And run the command below on each of the command prompt:
react-native start
react-native run-android
You might want to run the first command first and wait for it to be ready before running the 2nd.
Otherwise, you app might turn out to be blank.
Source : I tried it myself by creating new project and running the command as mentioned by the question.
What you can do is, first uninstall react-native-gesture-handler.
Then delete IOS and Android folder.
Then run below command.
1.react-native upgrade --legacy true // to recover ios and android folder.
2.npm install react-native-gesture-handler
3.react-native link
4.react-native run-android
5.react-native run-ios
Also update your MainActivity.java file , follow official website:
https://kmagiera.github.io/react-native-gesture-handler/docs/getting-started.html
Did you run react-native run-android or react-native run-ios ?
I tried to link packages using react native link command as well as manually and what does mean by Recovered References. my unlinked libs are showing there and how to resolve it?.
2.) Unable to link libRNvectoricons.a under Build Phrases > Link Binary With Libraries. could not find option there to link up.
Any help would be greatly appreciated.
Follow these steps:
Delete the node_modules folder inside the project
run npm uninstall react-native-app-auth
run npm install react-native-app-auth --save
run react-native link react-native-app-auth
Then follow these steps (iOS Setup & Android Setup)
I searched for this error on the git repo and online but I didn't find anything what brings me to here. React native is totally new for me so if I missed something stupid, my apologize.
I'm trying to install & link react-native-fbsdk in my react-native project: https://github.com/facebook/react-native-fbsdk
I went through these steps:
react-native init [YourApp]
Result: done, project created
react-native install react-native-fbsdk
Output: Scanning 712 folders for symlinks in C:\wamp\www\chatapp\node_modules (26ms)
rnpm-install info Module react-native-fbsdk has been successfully installed & linked
react-native link react-native-fbsdk
Output: Scanning 712 folders for symlinks in C:\wamp\www\chatapp\node_modules (29ms)
{ [Error: Cannot find module 'C:\wamp\www\chatapp\node_modules\react-native-fbsdk\package.json'] code: 'MODULE_NOT_FOUND' }
Print screen:
Of course when I try to build my app with react-native run-android I got this:
...
:app:processDebugResources
:app:generateDebugSources
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac
C:\wamp\www\chatapp\android\app\src\main\java\com\chatapp\MainApplication.java:16: error: cannot find symbol
import com.facebook.FacebookSdk;
...
More Info:
React native version: 0.42.3
npm -version 4.2.0
I didn't find "react-native-fbsdk" folder under
my node_modules folder.
Windows 8.1
I'm working with Android Studio
Android SDK Platform-Tools 25.0.4
Android SDK Tools 25.2.3
Thank you in advance.
Leo.
EDIT + UPDATE: Added react-native tag. Facebook team investigated this and it looks like an issue with React Native itself.
https://developers.facebook.com/bugs/1889723254644374
After few days with the community I found the problem!
This line is not valid commend for react native!
react-native install react-native-fbsdk
Instead we need to write:
npm i -S react-native-fbsdk
and then
react-native link react-native-fbsdk