I have a android application that connects/send/receive to/from a server as part of its operation.
my final goal is to run this application on a number of android emulators on a remote machine(to save some computing resources on my laptop).
I SSHed to the remote machine and created the emulators remotely using android create avd -n AVD_xxx -t 1 .
I tried to run the emulators using emulator-arm -avd AVD_1 but it gave error that looks obvious : SDL init failure, reason is: No available video device
(if I run the command one the michine directly, it will run just fine)
I will appreciate if you help me solve this issue.
Note:
I don't need video provisions. is it possible to disable that by configuring AVD? this is just an example. you might have better solutions.
There are two options:
export $DISPLAY and show the emulator on some X display (tunneled or remotely existing)
run emulator -no-window [-no-audio] to start it without the need of a X display
Related
I've been trying to get emulators to work for NativeScript on my brand new clean Windows 10 laptop for three days and nothing is working.
To be more accurate, I think I was able to get the 'emulator-5554' to launch, but it doesn't not load the Groceries app.
I have all the Angular requirements installed since I also build Angular SPAs and they work fine. I read and followed all these articles, and I still can't get emulators to work.
I even installed GenyMotion, but it is not detected. I have not installed Android Studio since I'll be developing with Visual Studio Code, so I used the Android CLI to install the SDK.
https://docs.nativescript.org/start/general-requirements
https://docs.nativescript.org/start/introduction
https://docs.nativescript.org/start/cli-basics
https://docs.nativescript.org/tooling/android-virtual-devices?_ga=2.188319272.1221867054.1547512018-618552819.1547075699
https://docs.nativescript.org/start/quick-setup
https://docs.nativescript.org/start/ns-setup-win - this was my primary emulator setup
I have also read many SO posts and none have solved my problem.
Is there some documentation somewhere that is simple and clear, with step by step instructions on how to get emulators installed that will work with Nativescript? What am I missing?
BTW, when I connect my Samsung Galaxy S8 Active phone to my laptop, it's not recognized by the tns device command either.
I can't believe it's this difficult to get emulators to work. I also can't believe that the Nativescript documentation has left this information out of their instructions.
This might not be the answer most are looking for, but this is what was wrong with my installation and this is how I fixed it:
I noticed that the docs all had $./advmanager [someArg] and I had to be sudo for commands to execute. So I ran sudo chown -R myUser:myUser /usr/local/android thus changing all owner:group permissions from root to myUser.
then I could run ./avdmanager create.... (full command below) without having to be superuser
restarted Nativescript Sidekick
I know this is kinda stupid, but I worked out that if the AVD was created as root, the Sidekick program running as myUser could not see and access it. This was confirmed when I ran avdmanager list avd as sudo and got a result, but after changing my files' ownership from root to myUser, nothing was listed from the same command.
I recreated my virtual devices (AVDs) as a normal user and Sidekick was able to see them.
edit: the actual line I ran to create the AVD (because I see a lot of variation in these):
$ ./avdmanager create avd --name Pixel -k "system-images;android-28;google_apis;x86" --device "pixel"?
The uppercase and lowercase "pixel"s come from one entry from the output of
$./avdmanager list
id: 17 or "pixel"
Name: Pixel
OEM : Google
---------
Do this "create" step for each device you want to emulate.
Install Android Studio and open it. Then (without starting a new project) click on:
Configure --> AVD Manager.
There you can create virtual devices, which will be recodnized by NativeScript Sidekick and its virtual device launcher.
Back again on Stack needing help from fellow Android Developers. In my development environment im using a lot of command line building and management. Currently im running into a issue where the Terminal "Using Mac OSX" when executing the command "emulator -avd nameOfemulator" the Terminal is still live.
Example of Launching Emulator
However even when the emulator is open and live, The Terminal is not let go to be able to execute additional command, I dont want to just open a new tab or window to have to execute my adb command's. Currently i can closes the emulator and kill the live terminal/emulator command by a simple 'ctrl-C' however this defeats the purpose if the emulator is closed.
Does anybody know of anyway of getting the terminal live again, either through a script, string of commands, different type of emulator's, etc.
UPDATE
Now running the following command emulator -avd NexusSeven & This emulator has the HAX Intel Hardware Acceleration enabled. And shortly after the terminal becomes available again, The string "HAX is working and emulator runs in fast virt mode" is inputted into the command input and makes the terminal live again.
Since MacOSX is just a fork of BSD Linux, the emulator can be run in background by appending the ampersand:
emulator -avd NexusSeven &
To ignore all output, the following command will help:
emulator -avd NexusSeven > /dev/null 2>&1 &
I wrote some test cases for a standard browser app using instrumentationtestcase packages for an android phone.
i am able to run the tests when the phone is connected to pc ..
is there a way to include these test cases in the app in such a way that these test cases are run when an activity is invoked!!
thanks in advance
You could use something like Adb Wireless (requires root) which lets you run and test your applications (from the IDE) but without having a cable.
If what you want is running tests by invoking something from the device... then I don't know if it's possible. But at least it seems very useless... what's the point of running JUnit tests if you cannot see what failed?
I would say yes if I have understood your question correctly.
There is "Dev Tools" available in Android emulator. You just need to create emulator in Eclipse. Then you need to fetch/install this application from emulator to your connected device. After that you install your test project in your device. Then you will be able to run that test project independent of your PC by selecting it from Instrumentation menu option of Dev Tools.
Following are the commands (you can change paths accordingly):
To copy from a running emulator to connected device, execute:
adb -e pull /system/app/Development.apk ./Development.apk
To copies the .apk file into the current directory. Then install it on your connected device with:
adb -d install Development.apk
Hope this was your problem and required solution.
When I want to test an android application, I create a new AVD, start it in the emulator, wait for the emulator to finish booting, and then use ADB to install the application, and when I'm done delete the AVD. Are there any tools that automate all of those steps? I tried writing my own but I couldn't find a way to tell if the emulator was completely booted, as the Android SDK website says not to use "adb wait-for-device install file.apk".
You're right not to use wait-for-device. It does not wait for the package manager to be available, which is what you need. I'm not sure how eclipse does it but you can poll the emulator until the package manager is available using the command adb shell pm path android. The command should return 'package: something'. Check out this python script that uses the technique: www.netmite.com/android/mydroid/1.6/.../adb_interface.py. It's pretty big but if you search for the command above you'll find the relevant piece of the script.
Why do you want to delete the AVD every time?
If you are deleting it every time because the install command throws an error due to the app already existing on the AVD, you can do this: adb install -r file.apk. The -r part is used for reinstalling the app. Here is the full usage instructions for adb.
Are you deleting it to remove the application you are testing and revert to a 'clean' emulator? If so it's not necessary to delete the AVD every time. You can specify the -wipe-data option when starting the emulator. This effectively resets the AVD to how it was when you created it. Here is the emulator documentation.
Hopefully that helps simplify your script.
This is pretty simple: I'm using NetBeans on Linux with Android emulator 1.6. I have Logcat on my android phone, but the process of getting the messages to somewhere readable isn't smooth at all.
Can someone tell me how to get Logcat running on the emulator? Is there anything I can do to see debug messages other then having to copy the apk to my phone and testing it?
Thanks in advance!
You have a few options for viewing the debug log output, assuming you have the SDK installed and your command path set up correctly:
Type adb logcat. The log output from the connected device or running emulator will appear. I usually prefer adb logcat -v time to see the time stamps.
Type ddms. This launches the stand-alone version of DDMS. It has a logcat display at the bottom.
Install the ADT extension for Eclipse, and open the logcat view. (Since you're using NetBeans I assume this isn't what you want to do, but I'm mentioning it for completeness.)
In all cases, the interaction is the same whether you're using a physical device or software emulator, because the ADB daemon conceals the details. Whatever you're doing for the device is also expected to work for the emulator.
If you have a device and emulator connected simultaneously, you can use adb -e logcat for the emulator and adb -d logcat for the device. From stand-alone DDMS or Eclipse, just pick the device or emulator from the pop-up menu.
If you have setup nbandroid you can find the adb logcat viewer in netbeans under:
Window -> Output -> ADB Log
--edit
Just followed up on the post above and started using C:\Program Files (x86)\Android\android-sdk-windows\tools\ddms which is alot better then the one in netbeans.
The SDK comes with a handy tool called ddms it should be in the tools folder of the SDK.
At the moment an Emulator is running, or a mobile phone is connected to your machine it should show up in ddms and you can see all the log output in ddms.