I have 2 devices detected in adb. One from my genymotion, and the other from my real device :
$ adb devices
List of devices attached
192.168.57.101:5555 device
e78ab88d device
I want to run my ionic app on e78ab88d device. How can i achieve this?
If i run ionic run android, its automatically run on my genymotion device. It says, no target specified.
img no target specified
What command to run on specific device?
run with target device id, something like :
ionic run android --target=e78ab88d
EDIT
With new Ionic 3 CLI use :
ionic cordova run android --target=e78ab88d
For list of all available devices, use :
ionic cordova run android --list
try this command may help you
ionic run android --e78ab88d
Using --target=e78ab88d failed for me. But it seemed to work when I used --device=e78ab88d.
Basically I have 2 Android phones connected and I wanted to target a specific device. without the --target or --device, it deployed randomly to the devices.
ionic cordova run android --device=e78ab88d worked for me. Just in case someone is experiencing the same problem as me.
to also run the app live do.
$ionic cordova run android -l
make sure that the phone is connected with laptop through cable.
Related
I've built an app using ionic2 + cordova, now I am trying to run this in a real device. I have already set up all the things I had to, such as: %JAVA_HOME%, %ANDROID_HOME%, %ANT_HOME% and all the paths as well. However, as I try to run the command: ionic cordova run android, I recevive this error: "CORDOVA IS NOT A VALID TASK".
When I run: "ionic run android" I get this another error: "No emulator images (avds) found, if you would like to create an
avd follow the instructions provided here:
http://developer.android.com/tools/devices/index.html
Or run 'android create avd --name --target '
in on the command line."
Please, I am new in the mobile world, so I thought about starting a small POC, but I am not even being able to run this in my cellphone. Could someone help me out in this issue? I would appreciate it
ADB only recognizes Android devices, and in order for it to recognize your device you need to enable Debugging Mode on the Developer Settings of the device. Check out this tutorial.
I got an issue on meteor JS on my windows 10, I have installed android studio and Java 8 JDK. On my meteor project I tried to build an android by typing meteor install-sdk android, but I got an error of This command is not yet available on Windows. .. Does anyone have an idea about this?
I know this was posted a year ago, but I found a fix recently, just in case anybody gets stuck on this and needs help.
It's from this link: https://github.com/meteor/meteor/issues/4155#issuecomment-384105563
But I'll repost the solution with a few extra changes I had to make by myself.
Basically you need to install Android studio and run it to get the Android SDK, install the Java JDK, and install Cordova. After this you can add the android platform to meteor.
Steps:
Install Android Studio
Run Android Studio once for download, full installation, and accept terms
Update npm with npm i npm
Run npm install cordova -g (-g flag for global install)
Run meteor npm i -g write-file-atomic path-is-inside async-some dezalgo
Run meteor add-platform android
After doing this, you should be able to run meteor run android-device to run on your Android device using a USB cable.
NOTE:
If you are connected to a WiFi network while running meteor run android-device, you might get an error similar to this:
Error detecting IP address for mobile app to connect to:
Found multiple network interfaces with non-internal IPv4 addresses:
'some IP address', 'some IP address'
Please specify the address that the mobile app should connect
to with --mobile-server.
To fix this, modify the command to:
meteor run android-device --mobile-server <ip.of.my.device>
Of course, ensure your PC and Android device are on the same WiFi network.
Go to Settings>About Device>Status to get your current IP Address on your Android device.
The app will now be installed on your phone over the WiFi connection.
(It might take a while though)
Hope this helps.
Cheers.
I am building an app with NativeScript, where I run:
$ tns run android --emulator
to build the app and launch it in an emulator. When I do this, the default android emulator boots on my machine, which is unusably slow...
In all the demos, they are using the Genymotion Emulator. I have installed this, but the NativeScript command still launches the default emulator. How do I get this to launch on the genymotion emulator?
NB: I am using Windows 10
Update:
Even if I run the command with the Genymotion emulator running (and nothing else), I get the following log output and a new terminal window is opened running android-sdk/tools/emulator-arm.exe
BUILD SUCCESSFUL
Total time: 11.959 secs
Project successfully built.
Using C:\Users\George\Source\Repos\NativeScript-App\Bluetooth\platforms\android\build\outputs\apk\bluetoothdemo-debug.apk
Starting Android emulator with image Xamarin_Android_API_23
That looks as though it is referencing the emulator I had been using when I was developing with Xamarin. Any ideas where I can change that, or why that is being called?
start Genymotion, then start one of the devices that you have setup in Genymotion
then check that the device is seen:
$ tns device
then run nativescript like so
$tns run android --geny 192.111.222.33:555
(or whatever is the name that you get from the tns device command)
To my experience --emulator always tries to start the stock emulators. Try to start genymotion and then just tns run android (w/o the --emulator option).
I think it does that when there is no emulator running.
Try starting Genymotion first, launch the image you want, then run the "tns run adroid" command.
I had a similar issue.
To use GenyMotion by default, first delete all the Android emulators using
android avd
I then followed the solution on this thread:
React-Native, Android, Genymotion: ADB server didn't ACK
Edit the settings in GenyMotion to use the android SDK you downloaded. (path for Windows is Users/YOUR-SYSTEM/AppData/Local/Android/android-sdk)
You still have to run the device on GenyMotion before running the emulator
tns run android
I'm trying to build an Android app using Ionic framework. I'm able to see the logs generated in the browser. But is there any way to get the logs in CLI when running the app in Android physical device instead of an emulator?
Connect your device with the USB cable. In Cli run command adb logcat
There is actually a way to see the same logs (as you would when in the browser) when running the app on the actual device by running the app with ionic like this:
ionic run android -l -c
-l switch is for livereaload
-c switch is for console logs
There is a way to debug?
I use
ionic run android
command to run the app on android but then - how can I see console.log() messages?
Thanks
If you run your app in the livereload mode you will see the console.log() messages. You can start it like this:
ionic run android -l
You can also use chrome developer tools like it would be a normal webpage. Here is good description how you achieve that: Remote Debugging on Android with Chrome
Connect with an android device which has Android OS version >= 5
Enable developer option from the settings. This procedure varies from device to device. In addition you must enable USB debugging mode from developer option or from other section of your device.
If you get any error like “Your device is not connected” from Android SDK or Android studio then find out the problem from your device manager of pc. Most of the time appropriate driver or driver is not installed in the machine. Download it and follow my instruction in a video (Yafi Tech).
Run the command ionic cordova run android. APK is built and installed in the device. done
run “chrome://inspect” in the chrome status bar. Remote debugging of connected device has been started.
Now run the installed application and operate from the device or chrome.
Click on inspect of WebView. For debugging Go to the console of browser if you want to trace out any error.
you can also watch video here
Now that there is a livereload option (-l), to see the console.log messages you have to use -c or --consolelogs
But to have logs, the livereload option is required so :
ionic run android -lc
See the documentation for more options :
http://ionicframework.com/docs/v1/cli/run.html
The Ionic CLI has been updated for ionic 2+ to deploy app in live reload mode use the following command.
Synopsis
$ ionic cordova run <platform> <options>
Example
$ ionic cordova run android -l -c
Make sure that you have installed the latest version of Ionic/Cordova CLI
with Ionic 5 and cordova 9 use:
ionic cordova run android -l --consolelogs
where -l is for livereload
If you want a real debug, with watches, step into, etc, try the Cordova Tools extension for Visual Studio Code
The page constains the instructions for debuging on device.
Connect your android device to computer/laptop and simply run below command
ionic cordova run android --device -l --debug
From ionic doc
ionic run ios [options]
http://ionicframework.com/docs/cli/run.html