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
Related
Does anyone know how to run an expo react-native app on multiple android emulators at once?
I have tried to run the app after running the emulators but it would run only on one emulator.
When I tried 'shift+a' it shows a list of emulators but when I choose the desired emulator it doesn't work.
This is the error 'Couldn't start a project on Android: The emulator (Nexus_S_API_30) quit before it finished opening. You can try starting the emulator manually from the terminal with: emulator #Nexus_S_API_30'
This says the emulator exited even though it is already running.
Install app in all emulator
Open all emulator
Run project from different port
For example
Run 'npx react-native start' for first emulator
Run 'npx react-native start --port 9988' from another terminal for second emulator etc
Open app from emulators
Open developer menu by pressing ctrl + m
Change bundle location to '10.0.2.2:PortNumber' eg : '10.0.2.2:9988'
While running my cordova application through command promt I'm getting the following error:
No emulator images (avds) found.
1. Download desired System Image by running: "D:\Software\sdk\tools\android.bat"sdk
2. Create an AVD by running: "D:\Software\sdk\tools\android.bat" avd HINT: For a faster emulator, use an Intel System Image and install the
HAXM device driver
How can I fix this issue?
I'm new to this hybrid application development ,please help me out this issues.
Try below from your command line:
# create avd
android avd
# run emulator
ionic emulate android
I haven't work with cordova applications before, but I think the answer is clear, it's asking you to make an emulator so that your application can run on.
first, you need to run the .bat file specified on your local machine
D:\Software\sdk\tools\android.bat
choose the sdk. And then re-run the .bat file choosing avd.
and by doing so an emulator should be installed on your machine for the cordova application to run on.
Can I run android emulator without an android phone? I have installed android studio and I've already installed android virtual device. However, when I try to run it, it gives an error like this :
Couldn't start project on Android: Error running adb: No Android
device found. Please connect a device and follow the instructions here
to enable USB debugging:
https://developer.android.com/studio/run/device.html#developer-device-options.
If you are using Genymotion go to Settings -> ADB, select "Use custom
Android SDK tools", and point it at your Android SDK directory.
I just want to see the emulator in my pc without usb. I have an iPhone but it just shows up in my phone not in my pc using expo scan barcode. I don't want to do that because in my opinion it's not comfortable for debugging etc. I am using windows in my pc so I can't use iOS for emulator.
how to run expo android emulator on windows?
Yes you can:-(With zero android studio config)
Install expo-cli globally.
Install android Studio.
Create a project by running expo-cli init
No need of any configuration on android Studio.
Open existing Project from android studio
then Open the created expo Project it will be available as an android project with a
android logo on it
then open the AVD Manager
Download and install whichever device you want but see to that its above android N
and do it for x86
after Installing the desired emulator
run the emulator before running the project
then run expo start to start the Project
Go to the metro builder and say run android
if it doesn't run on the first go or if you get error close the project
from emulator from recents and do a run on android again from metro
builder don't close project just the running project from recent on emulator
then it should work
Maybe too late, but I found out that is simplier that what you think.
Install your Android SDK (studio)
Create new emulator: Go to Tools > AVD Manager > Create new virtual device
(I chosen Nexus, Android 7)
When you get new emulator installed try to find out list of it ( command: emulator -list-avds )
!! If you do not have emulator in the path follow this commands in PowerShell:
PATH = %PATH%;C:\Users\[YOURUSERPCNAME]\AppData\Local\Android\Sdk\platform-tools
PATH= %PATH%;C:\Users\[YOURUSERPCNAME]\AppData\Local\Android\Sdk\emulator
PATH= %PATH%;C:\Users\[YOURUSERPCNAME]\AppData\Local\Android\Sdk\tools\bin
Run your emulator: emulator -avd [NAMEOFYOUREMULATOR] from the command emulator -list-avds
When emulator runing go to your Expo root folder (wher package.json is) and run npm start
Click on run in Run on Android device/emulator
Enjoy coding
Edit for Linux users
my linux usecase is as follow:
Install Android studio and open it
Install any emulator using AVD manager and try it's working
Close studio and go to your android folder ~/Android/Sdk/(two options 'emulator/' or 'tools/'), basically you need to find emulator
list item ./emulator -list-avds
choose your emulator and run it ./emulator -avd <any emulator>
if emulator not work use sudo
if you do not get any options in Sdk folder but you installed emualtor than you did it propably as a superuser - then the easiest is to completely remove all android studio and install it again
Delete the directory C:\Users\Rizwan.expo\android-apk-cache and opening the project on android again
It will run
There is another way to solve this problem. Follow the steps below in the same order:
run expo start to start the Project
Wait for the metro builder to be displayed in the browser.
On the terminal, wait for all options to be displayed, like so: To run the app with live reloading, choose one of:
Now load a device from Android Virtual Device in Android Studio (which already has the folder containing expo project open). On the terminal, press the key a.
Then the app should now open on the device being emulated.
The image describes my current situation properly. Please have a look at it first.
I am running my app on React Native. I have Android simulator on. I give the command to start the app. The app build finishes, but it says that virtual device not found, and in my simulator, if I open the app manually, it says that it cannot connect to Development server. It shows some issues.
Can anyone help?
Try run react-native run-android to connect your app to the emulator
Check USB Debugging is on(mostly running on virtual devices)
Check how you created project(react-native-cli or Expo) and run relevant app run command
Make sure your development server(node.js) is running when you run app. Sometimes it crashes then you have to again run command to run app
If all the step does not solve your issue try to uninstall app from device and run app again. Since react-native is still developing and its wired sometime these tricks works
I was having the same issue in Ubuntu 16.04. In my case the problem was that node packager wasn't running.
To check is packager is running easily you can open the browser and enter
http://localhost:8081/
You must see "React Native packager is running."
If you dont, then you can start packager from console running
react-native start
If you get an error like
" ERROR watch /your/project/path/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values-ru ENOSPC"
Then run first
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
Then run react-native start again and press the letter R twice in the emulator to reload.
Looking at the screenshot, seems like you don't have adb installed because there is a clear 'adb: not found error'.
Luckily Android studio ships with adb and is present in platform-tools under your Android SDK. (generally in /home/your-user-name/Android/Sdk/)
You only need to use it. Create a symbolic link in '/usr/bin/' or '/usr/local/bin/' depending how you'd like to use it.
Run the command:
sudo ln -s ~/Android/Sdk/platform-tools/adb /usr/local/bin/
After this run the app.
I have get everything setup by following on this tutorial (http://learn.ionicframework.com/videos/windows-android/). The problem is now, when I run ionic run android, the adb doesn't get the apk install into the virtual device run by Genymotion.
However, if I manually navigate to platforms\android\build\outputs\apk\ folder and run adb install android-debug.apk, then run ionic run android again, it will install into the virtual device. Everytime after I did the changes, I need to run adb install, then it will work.
How can I overcome it? Thanks.