How can we use Genymotion with Eclipse and Appium - android

REQUIREMENT - Need to connect a emulator with my Appium code. As my normal emulator takes even 2 days to open the menu screen, I have been trying to use "GENYMOTION" which is fast.
PROBLEM - After starting a virtual device, Looking in cmd prompt for list of devices keying "adb devices". I have my virtual device name listed as "192.168.175.101:5555". How can I connect the virual device? How can I install my app??
HELP NEEDED - Now how should I make use of Genymotion virtual device to work for my Appium automated test.
Should I make changes in the Android settings of Appium? If so explain.
Should I change the name of device in code?capabilities.setCapability("deviceName","192.168.175.101:5555");

Yes change port number in android settings and in code also both the port number should be the same i.e android settings and code port numbers.
To install the required app in connected devices follow the below points
1.Open command prompt.
2.type adb install space and then drag the apk file from the saved folder and click enter.
3.wait some time app will install and responds with success message

At maximum that you need to do is mention the device name as set in GenyMotion by you. The capability deviceName as used in android is currently ignored, you can refer the documents on appium.io
deviceName - The kind of mobile device or emulator to use iPhone
Simulator, iPad Simulator, iPhone Retina 4-inch, Android Emulator,
Galaxy S4, etc…. On iOS, this should be one of the valid devices
returned by instruments with instruments -s devices. On Android this
capability is currently ignored.
So you can continue using the line of code :
capabilities.setCapability("deviceName","192.168.175.101:5555"); //you can provide the name as "TestDevice", "Emulator" etc..
Irrespective of what name you provide, appium uses the first available device from the list of adb devices on your machine.
Also on your appium server GUI, you might want to uncheck the emulator option if you are using GenyMotion, as appium would treat it as a real device connected for automation.

Related

How to use apps on Android via adb tools?

I am using Android 6 Marshmellow.
I need to perform a local backup on Whatsapp without access to the screen. The motherboard has been damaged possibly beyond repair. The net result: Nothing displays on the screen. I have tried Windows 10 programs that display the Android screen in a window on PC but they don't work - possibly because the phone is failing to produce an output in the first place.
One program I used is this but the screenshot that the java app takes is pitch black. Hence my assumption the motherboard is incapable of producing a display at all.
Therefore, I would like to know if there is a way to execute app-specific commands such as telling Whatsapp to create a local backup via adb tools. So use Whatsapp via the Windows command line, through adb, as you can on Linux.
I cannot interact with the display; touch inputs are not registered. It has a password but the phone is not encrypted. My Windows 10 PC is a trusted PC and the phone has developer tools on.
More info here.
If you set that phone up for development and you can use adb commands to install an app (and send other intents), you might be able to try this out: Vysor
You can test this by simply turning on your phone, plug it in via USB cable and then run "adb devices" on your PC. Make sure adb.exe is in your Window's path.
Download the Windows app, install it and run it. Then plug in your phone. If this phone has developer options enabled and has been white-listed for the particular PC you're using, then it should allow the Windows app to install the Vysor Android app and start it. Once that happens, it should be able to connect and you'll see the phone's screen on your PC. Try it out with a working phone first if you like.
Good luck!
Find your emulator device ID. Run C:>adb devices
Find the package you want to debug. Run adb shell pm list packages .
Set the app to debug at startup (note the -w)
Start the app in the emulator.
Connect Android Studio Debugger.
Point to source code and set breakpoints.

Android: How to run/debug/test android app on tab?

I'm a novice in android app development (using Android Studio) and want to make an app and all set for go on but I have an issue and that is how can I run my app on my tab for test purpose as you know android emulator is slow (very slow). I had checked some answer but all are for window specific and I have Linux operating system.
I have a tablet (not rooted).
Usb cable.
wifi connection.
I need a way where I don't have to root my tablet and work on Linux too.
Thank you in advance
When you insert the cable of the tablet, linux should recognize it, if is not recognized you may install a driver.You can run the command:
$ lsusb
After that when appears the screen after you press run in AS, just select the device instead of the emulator.
If does not work, it could be that your tablet in development options ( psychically you have to interact with your tablet) does not have checked the option debug( on default is not activated), on some devices you have to look in the internet how to access to this option.
A last recommendation is to check in the manifest and in the build.gradle( take care there are two of them) that debbugable is set as true

Test android app on Virtual Box from Android studio

I have a very specific problem. I am trying to create an Android app for educational purposes, together with a friend of mine. The problem is, my processor does not support VT-x, which is essential for using an AVD, and my Android phone is considerably old so it can't really take much.
Therefore, the one solution I have in mind is using VirtualBox to create a 32-bit Android Virtual Machine and test my app there.
The problem is that, unlike an actual Android device and an AVD, a VirtualBox Android VM does not have, for what my knowledge is, an obvious way of being connected with Android Studio for testing each new app build.
So, what I am asking for is exactly that: a way to immediately test the app I have written in Android Studio in my Android Virtual Machine I have created on VirtualBox, including any workarounds that effectively allow me to immediately test the app on the VM, other than finding a way to make adb work with it.
I see I'm a bit late on this one but I figured it out. I am using Windows 8, running Android x86 (4.4 r1) on VirtualBox.
1. Set up a Host-Only adapter so that the VM has access to your network; You can set this up only when the Android image is off. Basically just go into your settings, click on Network, and select Host-Only Adapter in the drop-down labeled Attached to. For Adapter Type select PCnet-FAST III. Check the box next to Cable Connected if it isn't already.
2. Set up an NAT Adapter by selecting a different Adapter tab and for Attached to select NAT. For Adapter Type select PCnet-FAST III again. Check the box next to Cable Connected if it isn't already.
3. Enable Developer Mode by starting up the Android image, then going to Settings > About phone/tablet > Build Number. Click on Build Number 7 times. You should see a pop up that tells you how many more times you need to click to get into Developer mode. Credit to RMP PianoTuning's answer below
4. Get the virtual Android's IP address by going into Settings > About phone/tablet > Status > and then scrolling down until you find your local IP Address. Remember this number, you'll need it for the next step.
5. Start up Android Studio and go into the console; it should be one of the options in the bottom-left corner. Type in adb connect (IP address from step 4). Take a deep breath and hit enter. If it says
connected to (IP address)
you are ready to rock! When you run the app within Android Studio, your virtual Android should appear as Innotek GmbH VirtualBox, or something like the same. Select that puppy and enjoy your new, easy-to-test-on emulator. Its even Bluetooth Compatible! (but thats a whole 'nother story... google it)
Now a virtualbox isn't an answer to your need.
here are some alternatives,
Genymotion http://www.genymotion.com/ which is an easy to use android emulator , i suggest you look into it. based on virtualbox , can be integrated into android studio with ease . needs an AMD-V proc if not a VT-x . If the processor does not support these, the emulator still works, but your emulated device will only be able to use one CPU.
The other option is adb over wifi, which will let you use your phone without doing the dropbox step http://forum.xda-developers.com/showthread.php?t=1685736. For this to work you will need root though.
I was able to follow OMiKeY steps and get my app to run in VirtualBox,
the part he leaves out:
In your Android simulated device, you have to enable Developer mode.
Goto 'Settings' -> About Phone/Tablet->Build Number.
click on Build Number 7 times.
For me I got pop up that told me how many more times I needed to click to get into Developer mode.
After that i re ran the adb connect XXX.XXX.XXX.XXX command
Here's how it works for me.
I just connect my android phone with USB to my host (Windows 10).
Then make sure the USB phone is found from within the guest OS (ubuntu desktop 18.04 in VirtualBox 6.0). (VirtualbBox app: Devices > USB > check the USB corresponding to my phone). Once it's recognized by ubuntu, there will be a phone icon showing up on the desktop screen.
Next, I start android studio (v3.3.2); once that is complete, from the Terminal window (Android studio: View > Tool Windows > Terminal), I type in: adb devices, which would list the devices attached and my phone is on the list.
Now I run the app for a test (monitor my phone and confirm if there's prompt)...and the app shows up on my phone. Hope this may of help for others.
If you are running Windows, open the specific port in Firewall. In VirtualBox in your Android instalation Settings->Network Adapter 2 Tab - Port Fowarding and create a rule with Protocol (TCP) - Host IP (Your IP) - Host Port (in my case 5555) - Guest IP (Same Step 4 - Check your IP ) - Guest Port (I put the 5555 too). Ok! Now I can run my Apps in VM.
AppData\Local\Android\Sdk\platform-tools>adb connect 192.168.0.101
connected to 192.168.0.101:5555
Running devices:
innotek GmbH VirtualBox
:-)

USB Debugging in VitualBox-hosted Android system

I have set up a virtual machine running an Android 4.4 system on VirtualBox, in a Windows 7 system, for convenience in testing an Android app I am trying to develop. What last remains, is to be able to make the guest Android OS look like it's connected to the host via USB, to be able to use USB Debugging. Is there a way to achieve that?
EDIT: By "convenience" I mean I do not have a good enough physical device at my hands at the moment, and my processor happens not to support VT-x, in which case I could just use an AVD with Android Studio. Therefore, the VirtualBox choice is the next best thing I got, until I get a new device on my hands. What has priority at the moment is to create the app's utility, looks will be taken care of later on.
If your Android system is rooted you can install Wifi ADB (or some similar application) through Android Play store and debug over TCP.
The steps can be simply:
Install Wifi ADB (from https://play.google.com/store/apps/details?id=com.ttxapps.wifiadb&hl=es)
Execute and start service (Bettle will go to green)
Open Command line in Windows 7 machine
Run the connection command, for example:
adb connect 192.168.125.232
Test device connection with
adb devices
Enjoy testing your application!

How to port my own device driver on android emulator

Can anyone tell me how can i install or port my own driver(EX: Display driver) on android emulator and how to test it....
Thanks, Manju
I'm guessing you have read the Display Drivers section of the porting documention as well as bits about the Android Virtual Device (AVD) emulator configuration already. An AVD device can be configured to match your characteristics of your display, but that won't actually test your display driver. It doesn't appear that the emulator is extensible in that regard (without modifying QEMU).
So .. perhaps write an application-level test suite that runs on the emulator, and then try it on your actual device.

Categories

Resources