React native is not build my project on cmd. Here is an error when I try to react-native run-android command
When I try it on Android Studio, it show second error. How can I fix it ?
Related
I want to link a library in react native version 0.70.1 but I got a error error: unknown command 'link' after trying this command react-native link react-native-notification-sounds
Linking is automatic since React Native 0.60. So no need to run react-native link.
After installing the library -
on android, just rebuild the app
npm run android
on ios, install the pod before rebuilding the app
npx pod-install ios
npm run ios
As written in the header, app executes when I start with expo, but many problem lines when I try to run with yarn react-native run-android in Vscode.
warning ..\package.json: No license field
$ "C:\Users\SAMSUNG\Desktop\React Native Projects\Uber\node_modules\.bin\react-native" run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1075 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
'adb' is not recognized as an internal or external command,
operable program or batch file.
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
> Configure project :expo
BUILD FAILED in 19s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Error: Autolinking is not set up in `settings.gradle`: expo modules won't be autolinked.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local
properties file at 'C:\Users\SAMSUNG\Desktop\React Native Projects\Uber\android\local.properties'.
Even if I created a file named local.properties inside android and wrote
sdk.dir=D\:\\AndroidSDK
Are these two codes doing different jobs? If the coding part is problematic, why one of them executes without any problem?
There are 2 workarounds with React Native:
React Native CLI - For an app that requires native modules and manual configuration of Android Studio and Xcode.
Expo CLI - SDK builds on top of React Native. Expo provides easy-to-use tools and APIs and native module compilation done by cloud Expo Server infrastructure.
By running expo start, Expo CLI starts a server to serve your app code to the Expo Go app on your device or emulator. There's no native module compilation happening on your local device and no need for Android SDK.
On another side, when you run yarn react-native run android, the Java JDK and Android SDK must be installed and configured to compile native modules.
Explore more at https://reactnative.dev/docs/environment-setup
I create a react native app in C9. Now, I want to develop this app on my local machine with android settings. I downloaded the project.
cd myProjectFolder
react-native start
npm install
react-native run-android
Also, I add a project name in package.json.
The error is below:
error Android project not found. Are you sure this is a React Native project?
If android project/folder does not exit in your root project then run :
react-native eject
I encountered this issue after I ruan ./gradlew clean. Tried serval methods but vain. Then I ran ./gradlew in the Android directory. It worked for me.
// Android
./gradlew
How to fix this error when run android emulator?
I create a first application using React Native. But when I try to run this command react-native run-android I got some error in my command line :
This app is default created app from react native CLI
I'm trying to open existing React Native project in the emulator on Windows 10, but it throws this error:
undefined is not an object (evaluating '_reactNativeParse2.default.Object.extend')
I'm using 0.45.1 version of React Native. Backend is Parse Server. Why is this happening?
Found this on Github issues. Try this for now:
edit package.json -> Replace 0.45.1 with 0.43.4 for react-native
'rm -rf node_modules' //get rid of previous module installations based on 0.45.1
npm install
react-native link
react-native run-android // but in separate window be running 'npm start' first.