I'm starting an app from Re-Natal template (didn't change it; project.clj from https://github.com/drapanjanas/re-natal/blob/master/resources/project.clj).
Then I ran
react-native start
re-natal use-android-device avd
re-natal use-figwheel
lein figwheel android
react-native run-android
The app runs ok on the device, but the repl stays at Prompt will show when Figwheel connects to your application, and the code won't reload.
The same happens on a real android device.
I'm also reloading the app after it starts.
Am I missing something?
Update: output from react-native run-android
Installing APK 'app-debug.apk' on 'Nexus_5X_API_28(AVD) - 9' for app:debug
Installed on 1 device.
BUILD SUCCESSFUL
Total time: 36.329 secs
This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html
Running /home/ale/Android/Sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081
Starting the app on emulator-5554 (/home/ale/Android/Sdk/platform-tools/adb -s emulator-5554 shell am start -n com.renatal/com.renatal.MainActivity)...
Starting: Intent { cmp=com.renatal/.MainActivity }
I have had this in other cases as well but one case in which this will happen is when you have done a production build with Leiningen and not subsequently re-run re-natal use-figwheel. To solve this you would have to
Run re-natal use-figwheel
Relaunch react-native start / npm run start
Reload the Android app.
Related
My React-Native(0.68.1) project runs properly on my emulator when using npx react-native run-android command and everything works fine with the metro bundler instance created by this command.
Only when I run project from android studio (2021.3.1 Patch 1) , app is build successfully and installed on emulator, but cannot connect to metro bundler (which I separately run using npx react-native start command).
I wanted to try and update the debug server & port as mentioned in other similar questions , but I cannot access the debug app menu even after dismissing the error (menu doesn't show when ipress the shortcut)
Issue also occurs on build installed on emulator via npx react-native run-android when I close the app and metro bundler created by the command and start a separate metro bundler. In this case but I am able to enter settings menu and enter "debug server and port " to 10.0.2.2:8081 and app connects to metro.
I am using mac mini m1.
To fix this issue
first of all, start your emulator and run adb reverse tcp:8081 tcp:8081 this command on the terminal and then run npx react-native start and then run your project in the android studio and it will automatically link your app to that bundle
I always used to start my Expo project by typing in the terminal expo start and then i (for iOS simulator). The day after iOS 16 got released, Expo started to behave differently. After running expo start it gave me a warning: This command is being executed with the global Expo CLI. Learn more: https://blog.expo.dev/the-new-expo-cli-f4250d8e3421
To use the local CLI instead (recommended in SDK 46 and higher), run:
› npx expo start and after pressing i it threw the following error:
Error running xcrun simctl help: You may need to run sudo xcode-select -s /Applications/Xcode.app and try again.
XDLError: You may need to run sudo xcode-select -s /Applications/Xcode.app and try again.
Unable to verify Xcode and Simulator installation. After this I killed the terminal and in a new one I decided to follow the command it gave me in the warning (after running expo start). I ran npx expo start and then i and it threw me a new error which was:
Unable to run simctl:
Error: xcrun exited with non-zero code: 72
CommandError: xcrun is not configured correctly. Ensure sudo xcode-select --reset works before running this command again., but this time it didn't gave me a warning before pressing i. I also tried to run the commands shown in the errors and re-run the app, but still the same errors were thrown. I updated my OS, XCode and also deleted and cloned the project again so i could re-install dependencies just in case something was wrong with them.
I have attached the GitHub repo link of one of my projects so you can test it as well. It's not just this project, it's all of the projects I use Expo, even the new ones won't start.
If anyone has any idea how to fix this and why this happens, I would really appreciate it :)
Uninstalled and re-installed Expo globally. Updated the simulator to iOS 16 and opened the simulator before running expo start. It works as it did before.
I have tried most of solutions on the stackoverflow and github issues related to react native but all in vain... for almost 2 weeks.
Environment
react-native-cli: 2.0.1
react-native: 0.56.0
Window 10 Pro
Using android device 5.1(lollilop)
well the app ran successful in expo client but i need to run the native code.
First error: Unable to load script from assets index.android.bundle on windows
so i was able to run command below and the error disappeared on the phone client
react-native run-android && adb reverse tcp:8081 tcp:8081
But this error has persisted on the package server console
Installing APK 'app-debug.apk' on 'BALR_X7 - 5.1' for app:debug
Installed on 1 device.
BUILD SUCCESSFUL
Running C:\Users\goldsoft25\AppData\Local\Android\Sdk;C:\Users\goldsoft25\AppDat a\Local\Android\Sdk\platform-tools/platform-tools/adb -s 7DM7R4KJ99999999 revers e tcp:8081 tcp:8081
Could not run adb reverse: spawnSync C:\Users\goldsoft25\AppData\Local\Android\S dk;C:\Users\goldsoft25\AppData\Local\Android\Sdk\platform-tools/platform-tools/a db ENOENT
Starting the app on 7DM7R4KJ99999999 (C:\Users\goldsoft25\AppData\Local\Android\ Sdk;C:\Users\goldsoft25\AppData\Local\Android\Sdk\platform-tools/platform-tools/ adb -s 7DM7R4KJ99999999 shell am start -n com.awesomeproject/com.awesomeproject. MainActivity)...
2nd error
development server return error response code --> 500 on the android device
Your help is appreciated
I ensure that i downloaded all the needed API android sdk build tools in my case API 28.0.3 and API 28...
then i run the command below.. pay attention to the location of the android sdk tools
goldsoft25#GOLDSOFTX MINGW64 ~/AppData/Local/Android/Sdk/platform-tools
$ adb devices
then later i run the command below in the same command line as below
adb reverse tcp:8081 tcp:8081
Then later i was able to run react-native run-android and it worked perfectly
When I run react-native run-android it builds successfully and there after
Mobile screen shows nothing more than loading from local host : 8081
I have tried adb reverse tcp:8081 tcp:8081
Start by closing the App on your phone and clearing phone memory.
Close metro bundler on your PC.
Then clear npm cache as follows: npm cache clean --force
Then clean up gradle as follows:
Change into android directory in your project folder: cd android
To clean clean gradle simply run: ./gradlew clean
cd .. back into your project's root directory.
Build your app again using whichever method suits you. My preferred method for RN apps without expo on a windows machine is as follows:
npx react-native run-android
Try either of these ways to fix it:
Try to Open Developer menu by press Ctrl + M in emulator and choose the Setting port, then input the value localhost:8081.
Try to connect the other wifi, then run 'adb reverse tcp:8081 tcp:8081'
Try to change the URL on chrome to http://localhost:8081/debugger-ui/
Cheer!
Samsung DeX!
Samsung DeX runs in the background to discover device connections, it uses port 8081. In my case, it interfered with Metro and adb reverse. Exiting the system tray app fixed the entire issue.
For some reason it was a watchman issue. I remember installing watchman a few days before and it was causing the issue. I uninstalled watchman and it worked.
Uninstalling watchman made it work for me.
I am building an app using react-native and i was using android default emulator without any problems. The only issue i am having is the emulator is really slow.
I wanted to try genymotion and installed it. How ever when i run react-native run-android it cannot find the Genymotion Emulator. Here is the Error i am seeing in the console.
BUILD SUCCESSFUL
Total time: 8.329 secs
This build could be faster, please consider using the Gradle Daemon: http://gradle.org/docs/2.4/userguide/gradle_daemon.html
ADB server didn't ACK
* failed to start daemon *
error:
Starting the app (/home/hduser/Android/Sdk//platform-tools/adb shell am start -n com.legacitinative/.MainActivity...
error: no devices/emulators found
I am not sure why it cannot find the emulator.
Appreciate any help.
Thanks
Sateesh
$ cd /home/hduser/Android/Sdk/platform-tools
$ ./adb reverse tcp:8081 tcp:8081
Try if adb can see your device with
$ ./adb devices