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!
Related
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.
Windows 10 (64 bit).
My emulator is locate on folder :
d:\Programs\Android\avd.android\avd\Nexus_4_4.avd\
My apk is locate on folder:
d:\Programs\Android\apk\my_apk.apk
I'm locate on folder D:\temp
If I want to start emulator from command line (prompt) I use the next command:
emulator -avd exus_4_4.avd
It's work fine. Emulator is success launched.
But I need more. Only from command line:
Launch emulator
Deploy d:\Programs\Android\apk\my_apk.apk to started emulator
Run apk on emulator
How I can do this from command line?
To install a .apk file you need follow the below steps
Open the command prompt inside d:\Programs\Android\apk\
Type adb install my_apk.apk and press Enter.
If the app is already installed in the device then use adb install -r FileName.apk
Check Android developer site for this kind of information.
https://developer.android.com/studio/build/building-cmdline.html
Install
adb install path/to/your_app.apk
and install with run
adb -d install path/to/your_app.apk
I used ant to build my Eclipse project from the command line in a debug configuration. (Eclipse Luna and Android NDK-R10d is broken, so I can't use Eclipse any longer. Confer, Eclipse/ADT plugin cannot locate symbols for r10d NDK).
I then performed an install using adb:
<Project Directory>$ adb install bin/AndroidPrng-debug.apk
When I rummage for the program on the device in Apps, the program is not offered. When I attempt to search for it by name on the device (AndroidPrng and com.example.prng), I'm provided with useless web search results. When I go to Settings → Apps, the app is shown under the Downloaded tab (it shows the name as com.example.prng). It has the familiar Force Stop and Uninstall.
I have DDMS running and waiting to capture LogCat output from the program. But even though the app is on the device, I cannot figure out how to run it.
How do I run and debug the app when it does not show up under Apps?
Assuming that your app do have an Activity from where you can navigate into other parts of your app.
Try using below command:
$ adb shell am start -n com.example.yourpackagename/.YourMainActivity
or $ adb shell am start -n com.package.yourpackagename/com.example.yourpackagename.YourMainActivity
This am start command, is a command-line interface to the ActivityManager.
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.
I have a bizarre problem: I want to start an android emulator and at the same time install an already built .apk. The thing is that I want to do all these from the command line and especially from ONE terminal. (actually from a Makefile...).
If i start the emulator, it never stops until I close it thus I cannot execute any other command. On the other hand I don't know emulator's name before hand, although probably will be 5554.
Why not start the emulator in the background? From the command line, this is done by appending an ampersand to the command:
emulator -avd <whatever> &;
and then communicate with it via ADB:
adb install MyApp.apk