Start AVD from jenkins - android

I am try to launch an android emulator from jenkins.
I have written a batch file as follows:
cd E:\android-sdk\tools
emulator.exe -avd "AVD" -wipe-data
I execute this batch file from jenkins. But it does not launch the emulator.
I have also tried launching it from python as follows:
bash = "E:\\android-sdk\\tools\\emulator"
print "executing: " + bash
f_handle = open('test_output_launch.txt','w+')
process = subprocess.Popen([bash, '-avd', 'AVD'])
But the latter gives an error 'PANIC: Could not open: AVD'.
Where as when I run the batch file normally without jenkins, everything works perfectly.
I need to launch the AVD, install apk on it, and run some automated tests via jenkins. Please help!!

I think, it should be permission issue. Try running the jenkins client as admin.
For Python, change your subprocess call to
process = subprocess.Popen(['emulator.exe', '-avd', 'AVD'], cwd=bash)

You can try your script in command line first.

It finally worked with 'Android Emulator Plugin' of jenkins.

Related

Start local Android emulator with Shell Script through Jenkins

I want to start my local Android emulator through Jenkins. I use the same command to start my emulator. The following is my command when I start from command prompt
An emulator starts as normal, so I saved this command as a shell script file
Then I run the script through Jankins like this
The following is the console output in Jenkins
It seems working but no emulator appear on the screen. What should I do next?
Thank you in advance!

Jenkins Pipeline does not detect Android Emulator

I am using Jenkins Pipeline to Checkout,Build and Launch Espresso tests on my emulator before archiving the APK,The problem is that I cannot launch the emulator automatically from Jenkins.However with the same command from Windows command line I am able to run the emulator:
Script
node{
// Previous stages and some magic...
stage('Test') {
bat "D:\\Tools\\Dev\\sdk\\tools\\emulator.exe -avd Nexus_5X_Marshmallow_API_23"
}
}
Screenshots of Jenkins Logs and same command on windows
Does anybody have an idea about what can be done to fix this issue ?
You shuold try running your command with single quotation marks:
bat 'D:\\Tools\\Dev\\sdk\\tools\\emulator.exe -avd Nexus_5X_Marshmallow_API_23'
I am also not shure if you need to escape your path.

Executing python script in android terminal emulator

I installed python 2.7 in my Android device and I tried executing a python script by typing the command in terminal emulator. The problem is that although I use the full path for python the following error appears:
link_image[1997]: failed to link ./python CANNOT LINK EXECUTABLE.
I tried to add environment variables in ./~bashrc but I didn't make it. Any idea ?
OK it is solved. I followed these steps (http://code.google.com/p/python-for-android/wiki/RunPythonFromShell) but first I had to put the file standalone_python.sh in /data/ because in sdcard I had no permission to execute. And finally using 'su' I made it to run my script as root.

Perl Script to run Junit test cases and unistall apk

What I want my Perl script to do is..
Run the specific Junit test cases from windows command line.
Uninstall the Apk file from android device or emulator.
I am having difficulty in getting started with 1.For step2 , I guess I can use
adb uninstall package name
Thanks.
You don't have to launch eclipse to run junit test cases.
Try running the Junit tests through script using command line.
More information here. http://www.jsystemtest.org/?q=node/44

Execute 'adb' from an APK

Planning to execute adb to do some operation from a TestActivity.Java and try to execute the TestActivity.apk.
File wd = new File("/Android/android-sdk-windows/tools/");
Process proc = Runtime.getRuntime().exec(
"adb shell monkey -p com.sample.cts -v 50", null, wd);
proc.waitFor();
Getting the following error:
java.io.IOException: Error running exec(). Command: [adb, shell, monkey, -p, com.sample.cts, -v, 5000] Working Directory: null Environment: null
Can you please help me on this?
adb stands for Android Debug Bridge and it's a local helper program for developers. I doubt that this program is actually located on the device itself.
This is an error that android sdk is not properly attach to your eclipse
Go to preference -> click on android -> see whether all sdk are files displaying -> if it not display go for solution that i given below
This thing properly happen when antiviruses remove some sdk files in your sdk folder
Solution:
Once again download the sdk file from beginning or otherwise get the sdk package from others and put it

Categories

Resources