I am trying to explore and use the Jenkins Android Emulator plugin in order to run my emulator within a CI environment. I have so far tried 3 different methods but none of them is able to run the emulator
Method 1:Using an existing emulator
Screenshot of the first method
In the job's configuration , Select Run an Android emulator during build, then Run existing emulator. In the AVD name I insert Nexus5X_6_8664 then Jenkins is able to find it.
When i run the job it gives me the following error :
Started by user Amine
Building in workspace D:\jenkins\workspace\Emulator
[android] Using Android SDK: D:\Tools\Dev\sdk\
$ D:\Tools\Dev\sdk\/platform-tools/adb.exe start-server
* daemon not running. starting it now at tcp:5857 *
* daemon started successfully *
$ D:\Tools\Dev\sdk\/platform-tools/adb.exe start-server
[android] Starting Android emulator
$ D:\Tools\Dev\sdk\/tools/emulator.exe -engine classic -ports 5768,5769 -report-console tcp:5833,max=60 -avd Nexus5X_6_8664 -no-snapshot-load -no-snapshot-save
init: Could not find wglGetExtensionsStringARB!
getGLES2ExtensionString: Could not find GLES 2.x config!
Failed to obtain GLES 2.x extensions string!
Could not initialize emulated framebuffer
emulator: device fd:964
HAXM is working and emulator runs in fast virt mode
emulator: WARNING: Requested adb port (5769) is outside the recommended range [5555,5586]. ADB may not function properly for the emulator. See -help-port for details.
[android] Emulator reported that the console is available on port 5 768
[android] Waiting for emulator to finish booting...
$ D:\Tools\Dev\sdk\/platform-tools/adb.exe -s emulator-5768 wait-for-device shell getprop init.svc.bootanim
emulator: ERROR: Could not initialize OpenglES emulation, use '-gpu off' to disable it.
ERROR: Timeout after 45000 milliseconds
$ D:\Tools\Dev\sdk\/platform-tools/adb.exe kill-server
Finished: NOT_BUILT
More details :
I have increased VMHeap, changed graphics to automatic, Hardware GLES 2.0 or Software GLES 2.0 (as in Android emulator: could not get wglGetExtensionsStringARB error or could not find wglGetExtensionsStringARB)
I have Tried many screen resolutions
I have added window.x = 0 window.y = 0 to #Nexus5X_6_8664.ini
Method 2:Creating a new emulator
Screenshot of the second method
In the job's configuration , Select "Run an Android emulator during build", then "Run emulator with properties" :
Android OS version : android-23
Screen density : hdpi
Screen resolutions : 480x800
Device locale : en_US
SD card size : 64M
Target ABI : x86_64
Emulator name suffix
When i run the job it gives me the following error :
Started by user Amine
Building in workspace D:\jenkins\workspace\Emulator
[android] Using Android SDK: D:\Tools\Dev\sdk\
[android] Creating Android AVD: C:\Users\Amine\.android\avd\hudson_en-US_240_WVGA_android-23_x86_64_mySuffix.avd
[android] D:\Tools\Dev\sdk\/tools/android.bat create avd -f -a -c 64M -s WVGA800 -n hudson_en-US_240_WVGA_android-23_x86_64_mySuffix -t android-23 --abi x86_64
[android] Could not create Android emulator: Failed to parse AVD config file
Finished: NOT_BUILT
When i run the same command above on my command line manually to investigate te errors it gives the following error :
Error: Flag '-s' is not valid for 'create avd'.
I try to remove -s and then -t then it requests :
Error: Package path (-k) not specified. Valid system image paths are:
system-images;android-23;default;armeabi-v7a
system-images;android-23;google_apis;x86
system-images;android-23;default;x86_64
system-images;android-23;google_apis;x86_64
system-images;android-23;default;x86
system-images;android-23;google_apis;armeabi-v7a
Method 3: Using command lines instead of Android Emulator Plugin
[Screenshot of the third method][3]
I have then decided to drop the Android emulator plugin and start using a regular Windows batch command from jenkins with the following lines :
D:
cd D:\Tools\Dev\sdk\tools\
D:\Tools\Dev\sdk\tools\emulator.exe #Nexus5X_6_8664
When i Run "adb devices" on separated command line I am able to view my emulator finally running; However the emulator's window is not displayed and it keeps displaying the following error :
D:\Tools\Dev\sdk\tools>D:\Tools\Dev\sdk\tools\emulator.exe #Nexus5X_6_8664
Hax is enabled
Hax ram_size 0x60000000
HAX is working and emulator runs in fast virt mode.
init: Could not find wglGetExtensionsStringARB!
OpenGL backend 'angle' without OpenGL ES 1.x library detected. Using GLESv2 only.
eglMakeCurrent failed
eglMakeCurrent failed
eglMakeCurrent failed
eglMakeCurrent failed
Please note if i run D:\Tools\Dev\sdk\tools\emulator.exe #Nexus5X_6_8664 from my command line manually I'm not having any problem as the errors above.
More details :
Jenkins services are running with my Login/Password access rights as an administrator. (I have followed cloudbees tutorial and it works fine)
I have added window.x = 0 window.y = 0 to #Nexus5X_6_8664.ini
On the issue with Method 1:
Can you try updating to the latest version of SDK tools. We had similar issue and it got fixed after latest updates.
Update the below and try again :
Android Emulator [27.2.9 (May 2018)]
Android SDK Platform Tools
Android SDK Tools
Intel x86 Emulator Accelerator (HAXM installer)
follow the below thread on how to update:
Emulator: ERROR :detected a hanging thread 'Qt event loop'
Related
In 64-bit windows 10, I downloaded and installed Appium-Inspector-windows-2022.2.1. Also in system variables I set the ANDROID_HOME and path correctly.
ANDROID_HOME= C:\Users\Sameera\AppData\Local\Android\Sdk
path=C:\Users\Sameera\AppData\Local\Android\Sdk\tools;C:\Users\Sameera\AppData\Local\Android\Sdk\build-tools;C:\Users\Sameera\AppData\Local\Android\Sdk\platform-tools
After that I started Emulator via command line using adb commands also and Appium server(Appium-Server-GUI-windows-1.22.2) in GUI mode.
[][1
However, when I tried to start Appium inspector, it throws,
Failed to create session. An unknown server-side error occurred while
processing the command. Original error: The Android SDK root folder '
C:\Users\Sameera\AppData\Local\Android\Sdk' does not exist on the
local file system. Read
https://developer.android.com/studio/command-line/variables for more
details
However, it exists.
I am making an automation script to automate a Real SMartphone Android 8.1:
Environment
Python 3.7
Windows 10 64Bits
Build-tools 29.0.3
java version "1.8.0_241"
Appium 1.17.1
Node v12.15.0
sdkmanager 4.0.1
ADB (Android Debug Bridge) version 1.0.41
Version 30.0.3-6597393
When I run my script, I get these error message:
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
--> We can't open Instagram. Please check if device is connected. Let's try again!
Message: An unknown server-side error occurred while processing the command. Original error: Performing Push Install
C:\Users\Nino\AppData\Roaming\npm\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk: 1 file pushed, 0 skipped. 87.8 MB/s (470052 bytes in 0.005s)
Appium log file:
https://github.com/gauthierbuttez/public/blob/master/appium_issue04082020.log
What I've tried:
I added this desired capability:
desired_caps['remoteAppsCacheLimit'] = 0
It didn't help.
I reset factory my Android device but it didn't help.
Does anyone already faced this issue?
Try to add noSign: true to capabilities. It might help.
I also suggest manually removing Appium Settings and Instagram apps before starting a new session.
In android world to run UI test with ADB, you need to execute this command
adb shell am instrument -w com.tarek360.sample.test
but before running this command you need to install your test package and main application Android package files (.apk files) to your current Android device or emulator, more info here.
Normally the APKs package names will be in the following format:
Main APK: com.tarek360.sample
Test APK: com.tarek360.sample.test
but in Flutter world, when I run flutter drive, for example, the following command:
flutter drive --target=test_driver/app.dart
I see only the main APK has installed and I don't see any test APK has installed on my device, I'm wondering how does Flutter Driver works with Android, it's important for me to understand because I have very customized CI and I build APKs in a completely different environment than the test runner environment.
Tests on your computer use Flutter Driver to connect to Flutter Driver Extension, that you must enable separately, inside your application using TCP and send commands to it using adb with port forwarding
I've been running Studio 3.0.1 for a few weeks. My project was working fine with the emulator and AVD. The next day, the first time I re-tried the emulator I got:
Emulator: emulator: ERROR: can't find the emulator executable
Emulator: Process finished with exit code -1
I have deleted and rebuilt a couple of different AVD devices, I checked that HAXM is running and my environment/system PATH variables are:
c:\Users\***\AppData\Local\Android\sdk\emulator
c:\Users\***\AppData\Local\Android\sdk\platform-tools
c:\Users\***\AppData\Local\Android\sdk\tools
I then connected a Galaxy S7 running Nougat and the emulator runs fine!
Further investigation shows that when I run the emulator from the terminal:
C:\Users\***\AppData\Local\Android\sdk\tools>emulator -avd Samsung_Galaxy_S7_API_24
I get:
Could not launch 'C:\Users\DHJ\AppData\Local\Android\sdk\tools..\emulator\qemu\windows-x86_64\qemu-system-i386.exe': No such file or directory
And when I run it from a different folder (why are there 2 locations for the emulator?):
C:\Users\***\AppData\Local\Android\sdk\emulator>emulator -avd Samsung_Galaxy_S7_API_24
I get:
emulator: ERROR: can't find the emulator executable.
Any ideas on how I can AVD working again?
I solved this by downgrading the emulator using the reply from:
How to downgrade Android Emulator
I'm trying to setup a Xamarin UITest without any luck.
When I try to run 'all tests', I get the following error:
execute: C:\Users\Brandon\AppData\Local\Android\android-sdk\platform-tools\adb.exe devices - exit code: 1
error: could not install *smartsocket* listener: cannot bind to 127.0.0.1:5037: Only one usage of each socket address (protocol/network address/port) is normally permitted. (10048)
List of devices attached
adb server version (39) doesn't match this client (36); killing...
could not read ok from ADB Server
* failed to start daemon *
error: cannot connect to daemon
ADB seems to be started just fine and the weird thing is that it seems to be using an adb version from another user, even though..
1) Tools > Options > Xamarin > Android is set to different path than the above-mentioned, for the Android SDK.
2) There is no system environment path variable that I can find for the above-referenced adb.exe path!
Am I missing something?
In my case it was Android Emulator version mismatch. Somehow Emulator got updated to the newer version:
After uninstalling Emulator, switching Feed to Microsoft instead of google and re-installing Emulator - error was gone and everything worked just fine.