nativescript console.log() is not working - android

I can't see console logs in my nativescript/angular app in a super simple scenario - on button tap I have console.log('hello').
So far I've tried using Sidekick, VS Code, tns run android, tns debug android, tns device log, adb logcat and bunch of other commands I found in Google.
I am using nativescript 6.3.0 and my environment is correct according to tns doctor/tns info
I wonder if anyone had similar problem?

Related

when i use "tns preview" to start an android emulator i get an error code

i want to preview my nativescript code on an android emulator which as i use the command line which is, i navigated to my app folder which which was successfully but when i type "tns preview" to run an android emulator to see my code in action i get
Found peer TypeScript 3.1.6
#
# Fatal
process OOM in insufficient memory to create an Isolate
#
TypeScript compiler failed with exit code 3221225477
and an android emulator is connected successfully, even nativescript notice the emulator, please what do i do
i have tried the Nativescript sidekick to start the emulator but the nativescript sees the android emulator and it did not report an error indication but when i select the android emulator and click "Run on Device" i get
Build failed. TypeScript compiler failed with exit code 3221225477
even i have tried using my android device for previewing it which i install the nativescript playground & nativescript preview but if i scan the QR Code it is not previewing, please help out
please i need a solution
Preview is to be used with real device for quick testing. The basic idea is to avoid setting up whole iOS / Android SDKs on your local machine.
Produces a QR code which can be used to preview the app on a device without the need to install various SDKs and tools or configure your environment for local iOS or Android development.
To scan the QR code and deploy your app on a device, you need to have
the NativeScript Playground app:
App Store (iOS):
https://itunes.apple.com/us/app/nativescript-playground/id1263543946?mt=8&ls=1
Google Play (Android):
https://play.google.com/store/apps/details?id=org.nativescript.play
If you want to view your app on your android emulator, run the command
'tns run android --emulator'
This is assuming you already have an emulator set up on your machine.
To see a list of your available devices run the command
'tns device'
If you have not set up an emulator follow setup here: https://docs.nativescript.org/tooling/android-virtual-devices

Flutter sample app not working

Today I started development in Flutter. I have completed setup and installation process. When I try to run sample app created by following steps mentioned here.
I don't know what can be problem/Issue.
But output look like this in Android Emulator.
I assume it is an issue with hardware rendering in the emulator.
See also https://github.com/flutter/flutter/issues/12112
If it actually is the problem you should be able to work around with
flutter run --enable-software-rendering -t lib/main.dart
(-t lib/main.dart is default and optional)

phoneGap console.log ubuntu

I'm new in phoneGap and have problem to debug my app, I know that exist a lot of post about this but really I don't have idea how make this work.
I have console.log("message") in severals part of my code; but how can see this message when run my app?
I use this command to run
phonegap build android
phonegap run android --target=G7T7N16A26000893 --debug
with this result
with this not terminal still open to see anything. Aditional I try with Chroome DevsTools; but look that is only for pages not for apps.
Thanks #Kerri Shotts you are rigth, with google in remote devices could see apps, full tutorial her

nativescript livereload on device

i am using https://github.com/NathanWalker/angular2-seed-advanced which creates a running nativescript app.
now, i am a starter with nativescript and wanted to ask, how i can achieve a good development flow.
i am coming from ionic where i was able to see the console output on my development machine and was able to test my app live on a cable connected device. live reloading was running also.
so my questions:
can i run my app on a device without publishing it to the store
will i be able to see the console.log output somehow on my local dev machine with adb or a nativescript cli command?
is live reloading possible for developing nativescript apps?
Thank you in advance!
yes
yes
yes
tns livesync android --watch
You can install the app to your own Android / iOS real devices and/or the iOS simulator and Android emulators, all without sending it to any of the stores.
You can see the log fine, typically when you do a tns run [ios|android] the log is pipped back to your console. You can also run the standard adb logcat (android) or idevicesyslog (for iOS if installed)
Live reloading is possible, and works fairly well. You can use the tns run [android|ios] which is built into the tns command line.
The answer to all three questions is yes (as another answer point out). To add to answer of question 3,
As of nativescript version 2.5.0, tns run and tns livesync does the same thing, tns run has the ability to apply changes and sync it to a running app on device/emulator. The message on console clearly says tns livesync is being deprecated, so you should always look to use tns run
Here are the latest options(As of 2018-Jan) to run the app in live sync mode with a device when you are using NathanWalker -angular-seed-advanced.
iOS (device): npm run start.ios.device --debug
Android (device): npm run start.android.device --debug
--debug option will pull in more logs from the device(not just for your app, but also other activities)
Check the latest doc here for up-to date commands,
You can also use adb as explained here,

Installing phonegap app to android emulator using windows CLI

I'm trying to install my Phonegap application onto an Android AVD/Emulator. I have launched the AVD and it's registering as 5554:Nexus_S.
When using the Phonegap commands at the Windows prompt I am typing:
phonegap build android
phonegap install android
The output I get says it successfully installed the app onto the device, but it never shows up. This is the output of the install command:
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] trying to install app onto device
cp: dest file already exists: C:\Users\username\app\platforms\android\assets\www\phonegap.js
[phonegap] successfully installed onto device
I've tried variations of targeting the device using options with no luck:
--device=5554
--target=5554
Any ideas?
I figured it out. You have to specify the --emulator= in the call, so the command looks like:
phonegap install --emulator=emulator-5554 android
You can find the name/id of your running emulators by running the list-started-emulators.bat under the /platforms/android/cordova/lib/ folder in your project.
Another quick note is that sometimes even when you have started the emulator phonegap will not recognize it... so you have to start it from phonegap bat file so that the right process number is registered. to do this.
Use the following command,
1. List-emulator-images.bat : This will display available emulator images you have
2. start-emulator : This will start the emulator which will register with phonegap.
Also make sure you are running all of this from and ADMIN Enabled command prompt.
Okay, I've solved my problem. This solution may not be applied to all, but I was suffering from the same problem as I've mentioned in the comments of the question.
What did I do wrong?
I made some changes in one of the plugins.
I was working on my app and added the Vibration plugin. I made some changes in the plugin, both in the generic version [your_project_root\plugins\org.apache.cordova.vibration\src\android\Vibration.java] and also in the platform specific version [your_project_root\platforms\android\src\org\apache\cordova\vibration\Vibration.java].
But when I reverted the changes back, everything went fine.
I say it again, this solution may not be generic but can be useful for at least my type of problem.
And this gives rise to another question, can't we make changes in the Plugins?I think it is totally fine to make changes in them. Maybe I had done something wrong.

Categories

Resources