Invalid sdkVersion while running react native project - javascript

I'm stuck on the initial part of react native app building. I'm using create-react-native-app pkg to create the project and When I run the android version app through "yarn run android" command I get the error below:
Error: Invalid sdkVersion. Valid options are 10.0.0, 11.0.0, 12.0.0, 13.0.0, 14.0.0, 15.0.0, 16.0.0, 17.0.0, 18.0.0, 19.0.0, 20.0.0, 21.0.0, 22.0.0, 23.0.0, 24.0.0, 25.0.0, 7.0.0, 8.0.0, 9.0.0
It's a windows machine. Node v10.0.0, npm v5.6.0, Java 1.8 & android studio is already installed and working I added variety of APIs through android studio.. currently I have 17-23-24-26 installed in Sdk platforms.
And I get the following error on real android device:
uncaught Error: console.error: React Native version mismatch.
Javascript version: 0.53.0
Native version: 0.52.0
Make sure that you have rebuilt the native code. If the problem persists try clearing the Watchman and packager caches with 'watchman watch-del-all && react-native start --reset-cache.
I didn't find solution ...

I solve this issue by installation of Expo XDE window app.
the problem was missing schema-27.0.0.json file in directory:
C:\Users\{user}\AppData\Local\Expo
download Expo XDE
schema.json version is depend on react native npm version that you installed.
documents here

open your build.gradle file ( located in YOUR_PROJECT/android/app/build.gradle ) and validate your compileSdkVersion
EDIT
if you are using expo check sdkVersion in your app.json file and be sure it is same as one in package.json file

In the file app.json put "sdkVersion": "36.0.0",
{
"expo": {
"name": "name-app",
"slug": "name-app",
"sdkVersion": "36.0.0",
...

Related

Unable To Run Android React-Native App Due to CMake Path Versions

I am trying to run my react-native application but whenver i do it crashes and gives me this error:
Could not determine the dependencies of task ':react-native-reanimated:generateJsonModelDebug'.
> CMake '3.18.1' was not found in PATH or by cmake.dir property.
CMake '3.22.4' found in PATH did not match requested version '3.18.1'.
I don't understand what this means, i believe it has something to do with the react-native-reanimated package. this package has many issues and i do not know how to resolve them.
Any help?
It means you have to update the cmake version and export to your path directory.
Open Android Studio
Access SDK MANAGER
Access tools and found CMake
Click Show Package details
Then install the version 3.18.1

RNCSlider was not found in the UI Manager when trying to use #react-native-community/slider

I'm trying to create a slider in my react native Android App, and relatively new to React Native. The React Native documentation says their Slider component is deprecated (https://reactnative.dev/docs/slider.html) and directs us to use #react-native-community/slider instead (https://github.com/react-native-community/react-native-slider/blob/master/README.md).
I installed the library in my project directory using npm install #react-native-community/slider --save.
The install succeeded and my versions in my package.json are as follows:
"dependencies": {
"#react-native-community/slider": "^3.0.3",
"react": "16.13.1",
"react-native": "0.63.0" },
I am including the Slider in my source file with import Slider from '#react-native-community/slider';, however when ever I try to actually create a slider in my code with the <Slider> ... </Slider> tags, I get the following compile error:
ERROR Invariant Violation: requireNativeComponent: "RNCSlider" was not found in the UIManager.
I've been banging my head against the wall and can't figure out how to clear the error.
I am on Windows 10 x64 developing for Android.
Thanks in advance!
I've also faced this issue and if you've followed the setup instructions word by word, the solution should be:
Stop the Metro Bundler.
Stop the app on the simulator/physical device.
Run react-native-start.
Run react-native run-android or run the app on your physical device.
Done!
This is what fixed it for me for development on iOS. Hope this can be of help to you on Android as well!
The solution for me was to just run "npx react-native run-android" in my project directory rather than trying to use "npx react-native start". I'm not sure why this works, but it launches the metro server in another console window (using cli.js) rather than in powershell itself. This seems to solve the problem.
Historically I had been launching the app directly from my emulated phone OS, but this didn't work even if I had the metro server running in powershell.
run command in vs code terminal
cd ios
pod install
cd ..
react-native run-ios
or
react-native android
I tried #Californium's method to stop the Metro Bundler, Simulator, and re-run everything, but that didn't work for me. I also tried to link Slider, but that even didn't work for me.
react-native link #react-native-community/slider
I think You need to just
Import Slider form 'react-native'
This worked for me.
You can try all the steps, provided and if those didn't work. Use the slider from react-native.

React Native Version mismatch. Cannot generate build in Android Studio but runs properly through VS code react-native run-android

When I run react-native run-android from VS code it runs perfectly on my android phone. But when I try to generate build from the android studio it shows me version mismatch error. I have tried every solution from the internet but none of it resolves my issue. pleas help me out. this thing happened after I upgraded my react native project version from 0.57.3 to 0.58.3. I have even search in the whole project folder there is no such 0.57.3 found in any file or any filename or folder name. what is going wrong?
React Native Version mismatch.
Javascript Version: 0.57.3
ReactNative Version: 0.58.3
There is a chance to get this error when you run npm start somewhere else in other project but didn't shut it down when you run react-native run-android in current project. This make your current react-native app trying to read the js bundle of other project and cause react-native version mismatch.
Try run npm start in terminal and see if it load your js bundle properly.
after deleting index.android.bundle and then running this command react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/ made that error gone. hence error is solved for now dont know if anything other comes up

React native init android,ios and app folder missing

Missing android,ios & app folders and index js files
I'm using react native v 0.1.10 in windows 7 OS
We can generate android and ios folder by using upgrade
Run react-native upgrade to generate /ios and /android folders again.
Run react-native link for any native dependency. (if needed)
Finally run
react-native run-ios
or
react-native run-android
Probably you created your project using create-react-native-app, which is an even more simplified toolchain.
You should probably eject if you need android/ios native configs or something.
Please take a look at this doc: https://github.com/react-community/create-react-native-app/blob/master/EJECTING.md
Try this to generate the Android and iOS folder without change version
react-native eject
react-native link
Install a new file using powershell instead of cmd.
Run following commands
1. npx react-native eject
After running above command you can see output in console as follows
info Generating the iOS folder.
info Generating the Android folder.
Next below command
2. npx react-native run-android
Try update ur nodejs and npm to the latest version then run everything again starting from init
npm run eject
next we will get some couple of questions,
? how would you like to eject from create-react-native-app
React-Native : I'd like a regular react native project
? What should your app appear as on a users's home screen? _Your wish____
? What should your Android Studio and Xcode projects be called? rncourse
After Ejected Successfully the project structure will change, added folders android and ios.
happy coding

React-Native module is being looked for in an invalid directory

I am helping with a project. The code is written mainly in TypeScript. We use babel to translate ES6->ES5. The front-end is developed with react-native. Recently, after updating babel, packages became "missing." I manually locally installed each package and one-by-one got the project to compile up to the below error, shown sometime after packer starts.
+ react-native bundle --entry-file index.ios.js --platform ios --dev true --bundle-output /Users/shmukler/Library/Developer/Xcode/DerivedData/MyApp-gjqyntaykupdmhaecjypkdppuznf/Build/Products/Debug-iphonesimulator/MyApp.app/main.jsbundle --assets-dest /Users/shmukler/Library/Developer/Xcode/DerivedData/MyApp-gjqyntaykupdmhaecjypkdppuznf/Build/Products/Debug-iphonesimulator/MyApp.app
uncaught error Error: UnableToResolveError: Unable to resolve module LinkedStateMixin from /Users/shmukler/Projects/myproject/myapp-ios/node_modules/react-native/Libraries/react-native/react-native.js: Invalid directory /Users/node_modules/LinkedStateMixin
I installed LinkedStateMinin with npm install react-addons-pure-render-mixin - much like all other packages. Why is it looking for it at
/Users/node_modules/LinkedStateMixin ? How can I change that? Where are those paths specified? Could I manually hack the path just to get the app to build, as a temporary way to move forward?
Thank you

Categories