For the last few weeks I've been developing an app for Android using React Native, and overall the experience is pretty good, however I feel like I might be missing something. Does anyone have any pointers?
My flow is
Start Android Studio
Wait for build/sync
Run app on physical device or AVD
See the expected red screen
Start the Metro server
Now the app is running
Run pidcat com.myapp to see device logs
Make JS changes via VSCode
Hit reload in Flipper (no hot-reloading?)
Re-navigate to the screen I'm working on
So far it's all good other than the lack of hot-reloading.
However whenever I made a change to some Java code, I need to hit Rebuild in Android Studio, and this takes quite some time usually.
Is this all normal? Perhaps I'm missing something.
Thanks in advance
You don't have to start Android studio.
If using Flipper, start Flipper first.
Start metro server in one terminal
run react-native run-android in another terminal.
To reload type r in the terminal with metro server.
Changes to JS side should automatically reflect in the device. ( https://reactnative.dev/docs/fast-refresh )
With react-native you shouldn't be making big changes to the native side of the codes. If reloading doesn't reflect the changes to the native side. Then close the metro server and build again.
Related
After I updated my Dart extension in VS Code, it doesn't automatically hot-reload my Flutter codes even though I've turned on autosave. Does anyone have an idea about how to solve it?
If you using VS Code, Go to the Settings > Extensions > Dart & Flutter
Then select always in Flutter Hot Reload On Save
Congrats 🥳 Your problem is solved.
PFA screenshot here
Run the flutter doctor command and make sure that flutter is installed properly on your machine.
Which channel are you running on? Make sure that you run on the stable channel, as long as it does not give you any compile time issues.
If the flutter doctor works, then make sure that, if you are running on iOS (Physical Device), that you have bonjour service enabled. This is required in order to make debugging work on physical devices (for iOS 14+). Please also make sure that you add -v command to the end of your deploy function, to increase the log verbosity.
Otherwise you can just deploy to the simulator.
If you are running on Android, there should not be any issues, unless there is a problem with the logcat. In this case you can try to go to android Studio and reboot the ADB (Android Debug Bridge), in which case the machine will try to reattach a debuggable process to your device. If it's still not working, then try another device. If that's not working, then add the -v command, I mentioned earlier, about log verbosity.
Post an update on your issue, once you have tried all of these suggestions.
[EDIT]
Please make sure that hot reload is enabled on the vscode settings.
Go to Settings > Search > Hot Reload, and make sure it's enabled for both Auto Save & Restart.
Please take a look at this image below:
[EDIT ONCE AGAIN]
If you look at the flutter documentation (https://flutter.dev/docs/development/tools/hot-reload) it says, that to run a flutter hot reload, you have to follow these steps:
Run the app from a supported Flutter editor or a terminal window.
Either a physical or virtual device can be the target. Only Flutter
apps in debug mode can be hot reloaded. Modify one of the Dart files
in your project. Most types of code changes can be hot reloaded; for a
list of changes that require a hot restart, see Special cases. If
you’re working in an IDE/editor that supports Flutter’s IDE tools,
select Save All (cmd-s/ctrl-s), or click the hot reload button on the
toolbar.
Make sure that you follow all the steps in the documentation, then let's talk on this post again (https://flutter.dev/docs/development/tools/hot-reload)
Asked and answered over here: Flutter doesn't hot reload on autosave in VSCode. In short, it is working as designed.
The "hot reload on save" feature was intended to run when the user specifically pressed save so they had some control over when it occurred. Some users experienced issues where autosave would cause it to fire when they didn't want it to, so this "bug" was recently fixed.
It turns out that for many users, hot-reload-on-autosave worked fine, so the next version of the Dart extension will include a setting to allow you to re-enable that.
"dart.flutterHotReloadOnSave": "always"
For VS Code Go to 'File' -> 'Auto Save' make sure you have "check" Auto Save.
If you’re running the app at the command line using
flutter run
command, enter r in the terminal window to hot reload.
Try to run by clicking Run button worked in my case.
Like this
I am working on an app,which I have installed in my Smartphone, I wanted to check the flow of code while running the app.
using Android Studio I installed the app via USB Debugger, and open the app project files in
chrome://inspect/#devices
, while running , I have added multiple breakpoints in the code to see the flow, but the code haven't stopped at any breakpoint, yet there is no issue with the running of app, the app ran smoothly.
I am facing the same issue while using emulator as well.
Can someone help me to figure out, what I could do ?
EDIT -
I have followed #KannanSJD instructions as well, by "Attaching Debugger to Android" and selecting "Java Only" but not got any success. , As you can see in the below attachments
make sure you attach your debugger to your app process. Use the below icon on top left
if your app package and its process is not showing then make sure you are running in Debug mode and not in release mode using build variants.
Make sure your app is open and you see your process as in screenshot.
Also instead of detect automatically you cna use Java only if you have NDK also used in your project. This will fasten the process of attaching debugger.
Also make sure you find the following log in your debug console.
Please check if you have muted your breakpoints, refer following image. That should NOT be enabled.
I´ve been trying to build my first app with react native but when I change the App.js the changes are not reflected when I run the app on my anroid device.
I even tried putting in comments all code to see if something changes but remains the same.
I´m using react-native-cli: 2.0.1 and react-native: 0.53.3
Sorry if writing wrong but English is not my "native" language :V
My code:
App.js
index.js
Hope you can help me, but I will keep trying.
I realized that when the app is running in a virtual device, the changes are reflected.
For real device, shake your phone to open the debug panel.
Make sure the Enable hot reloading option is switched on.
https://facebook.github.io/react-native/docs/debugging.html
This is not the main problem, but it's better to have a <View></View> component to wrap the Text component. So you can add more component and apply styling later on.
First of all I apologize that I am not a programmer and my IT knowledge is limited.
I have written a very basic python program which runs on windows.
I just want to run it on my android phone.
I checked with Qpython app for android and I could not figure out what to do with that.
Please let me know how I can run this program on my android phone.
Please describe the solution keeping in mind that I don't understand much of the IT jargon.
Run python program in android with Qpython:
Create program and run it:
Go to Editor.
Write Your Script.
Tap Save icon. ('4th icon' at bottom)
Tap Run. ('Arrow icon' in middle at bottom)
Script will run and output/errors will be shown in logfile in notification bar.
Run existing script:
Tap on big button with python logo in center of screen.
Tap run local script.
Tap on script you want to run.
http://wiki.qpython.org/doc/how-to-start/
edit: There is another app from same developers called Qpython3 in which you can run python3 applications including scripts and projects.In Qpython3 after running script it will take you to console for output instead of showing logfile in notification bar.
It is same as Windows/Linux. You just have to be confident before trying something new. IMHO no one is professional at first try.
Please see video and let me know if you need further help.
https://www.youtube.com/watch?v=UqlTErvbRdE
For long and deep understanding:
https://www.youtube.com/watch?v=So2weWysyZc
I you know python 2(version).This will help.
http://code.google.com/p/android-scripting (the home of the SL4A project.)
This is by-far the best way you can run your Python app on android
STEPS-TAKEN: Not sure what the source of the problem is, but the quick description of the bug is that:
I install all required software, SDKs, configs,
Then create two new projects each using the tabbed-window template, each of which support deployment to Android.
Then I run one project via Titanium Studio's Run option, let the Android Emulator load, and confirm it's the app is installed an working.
Then I closed the emulator, and then run the other project the same way as the last, though when the app is shown on the screen it has the name of the first app, not the app run.
FIXES-TRIED: I've attempt executing "Project >> Clean" for all projects before the second run, and still get the same "bug".
SETUP: To my knowledge all of my configs are correct, and clearly the build "works" though it is very possible there is something wrong with my installation build chain to get to the point I'm running the app in Titanium Studio via the Android Emulator.
ERRORS: I've reviewed the console output for FastDev, AppInstall, Android-Emulator, etc and have seen no error messages that jump out; meaning I have seen no error messages, except for build.py error after the first script runs saying it didn't find the script running on a port when it attempt to kill it; given the request is to kill itself, and it's not found, I just assume this is a confusing way of saying the script did what it was suppose to do.
Current build: is on Windows-XP-SP3 using TiStudio 2.0.1 build, JavaSDK 1.6, r18-Android, and Android-2.2
Recent emulators have persistent state, so your second launch probably gets back the system you were running before.
You should not have to resort to this on a regular basis unless something is broken in the workflow, but deleting the AVD and making a new one should get you a clean slate.
I believe there is also a startup flag to the emulator which tells it not to use the checkpoint from a previous run, but start from scratch - you could try to change your configuration to use that flag.
A downside to either deleting or forgoing checkpoints is that the emulator will take longer to start up.
Really though, you are supposed to be able to re-install or launch a given application, or install a completely different one, all within the same running of an emulator. You aren't supposed to need a new emulator, any more than you need to go buy a new device (or perform a factory reset on it). So something is not right in the setup, and the best solution for long term productivity is to identify and fix that. Short term of course, you might need to wipe the slate clean if that helps you meet today's deadline.