Happy new year all, I'd gratefully appreciate if someone could help or shed some light into this issue.
I've just set up appium 1.7.2 server on MAC OS High Sierra v 10.13.2, running appium through below command.
appium -a 127.0.0.1 -p 4723 --log-level=debug
Below is my .bash_profile
n.nadarajah#EGHJ-MACRDV01 ~ $ cat ~/.bash_profile
# Setting PATH for Python 2.7
# The original version is saved in .bash_profile.pysave
ANDROID_HOME=/Users/n.nadarajah/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home
ANDROID_PLATFORM_TOOLS=$ANDROID_HOME/platform-tools
ANDROID_TOOLS=$ANDROID_HOME/tools
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}:$JAVA_HOME:$ANDROID_HOME:
$ANDROID_PLATFORM_TOOLS:$ANDROID_TOOLS"
export PATH
Echoing $ANDRIOD_HOME env variable
n.nadarajah#EGHJ-MACRDV01 ~ $ echo $ANDROID_HOME
/Users/n.nadarajah/Library/Android/sdk
Below are the Appium logs on test execution.
n.nadarajah#EGHJ-MACRDV01 ~ $ appium -a 127.0.0.1 -p 4723 --log-l .
level=debug
info: Welcome to Appium v1.4.16 (REV
ae6877eff263066b26328d457bd285c0cc62430d)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {"address":"127.0.0.1"}
info: Console LogLevel: debug
info: --> POST /wd/hub/session {"capabilities":{"alwaysMatch":
{"platformName":"Android"},"firstMatch":
[{}]},"desiredCapabilities":{"deviceName":"Android
Emulator","app":"/Users/n.nadarajah/sites/Resilient-
QA/EndToEndTesting/apks/app-
debug.apk","platformName":"Android","automationName":"appium",
"appPackage":"com.resilientplc.smartnumbers.debug"}}
info: Client User-Agent string: Python http auth
info: [debug] No appActivity desired capability or server param.
Parsing from apk.
info: [debug] Using local app from desired caps:
/Users/n.nadarajah/sites/Resilient-QA/EndToEndTesting
/apks/app-debug.apk
info: [debug] Creating new appium session
a5cfbee9-bcd6-41af-a90c-0389ab244d2c
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_151
info: [debug] Checking whether adb is present
warn: The ANDROID_HOME environment variable is not set to the Android
SDK root directory path.
ANDROID_HOME is required for compatibility with SDK 23+.
Checking along PATH for adb.
info: [debug] executing cmd: which adb
info: [debug] Using adb from /Users/n.nadarajah/
Library/Android/sdk/platform-tools/adb
info: [debug] Parsing package and activity from app manifest
info: [debug] Checking whether aapt is present
warn: The ANDROID_HOME environment variable is not set to the Android
SDK root directory path.
ANDROID_HOME is required for compatibility with SDK 23+.
Checking along PATH for aapt.
info: [debug] executing cmd: which aapt
error: Problem parsing package and activity from manifest: Error: Could
not find aapt. Please set the ANDROID_HOME environment
variable with the Android SDK root directory path.
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Could not
find aapt. Please set the ANDROID_HOME environment variable
with the Android SDK root directory path.
info: [debug] Error: Could not find aapt.
Please set the ANDROID_HOME environment variable with the
Android SDK root directory path.at ADB.<anonymous>
(/usr/local/lib/node_modules/appium
/node_modules/appium-adb/lib/adb.js:126:12)
at ChildProcess.exithandler (child_process.js:279:5)
at ChildProcess.emit (events.js:159:13)
at maybeClose (internal/child_process.js:943:16)
at Socket.stream.socket.on (internal/child_process.js:363:11)
at Socket.emit (events.js:159:13)
at Pipe._handle.close [as _onclose] (net.js:568:12)
info: [debug] Responding to client with error: {"status":33,"value":
{"message":"A new session could not be created.
(Original error: Could not find aapt. Please set the ANDROID_HOME
environment variable with the Android SDK root
directory path.)","origValue":"Could not find aapt. Please set the
ANDROID_HOME environment variable with the
Android SDK root directory path."},"sessionId":null}
info: <-- POST /wd/hub/session 500 164.317 ms - 344
Questions:
1. Why does appium cannot see the system environment variable?
I've tried appium server versions 1.7.2 & 1.7.1 & 1.6.2 & 1.4.16 the symptoms were the same.
Could someone help me out with this please.
Thanks
Niro
I've got to the bottom of this issue,
turns out I've missed another android env variable.
In the above case I've missed ANDROID_BUILD_TOOLS
At the point of writing this, below are the list of Env variables required for appium.
ANDROID_HOME=/Users/n.nadarajah/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/
Contents/Home/bin
ANDROID_PLATFORM_TOOLS=$ANDROID_HOME/platform-tools
ANDROID_TOOLS=$ANDROID_HOME/tools
ANDROID_BUILD_TOOLS=$ANDROID_HOME/build-tools/27.0.3
Append all the above env variables to $PATH
works for me in Mojave.
After editing ~/.bash_<profile or rc> I use:
source ~/.bash_<profile or rc>
It not only loads the new variables values, as reports any error on file as well.
here is the workin list of environment variables:
export ANDROID_HOME=/Users/user/Library/Android/sdk
export PATH=$ANDROID_HOME/:$PATH
export
PATH=$ANDROID_HOME/platform-tools/:$PATH
export
PATH=$ANDROID_HOME/tools/:$PATH export PATH=/usr/local/bin/:$PATH
launchctl setenv ANDROID_HOME /Users/user/Library/Android/sdk
works on highSierra, of course, tweak Your paths...
here I have installed android studio in default path.
First Set Android home: create a new System Variable
ANDROID_HOME : C:\Users\<user name>\AppData\Local\Android\Sdk
Add bellow three path in path system variables
C:\Users\<user name>\AppData\Local\Android\Sdk\platform-tools
C:\Users\<user name>\AppData\Local\Android\Sdk\tools
C:\Users\<user name>\AppData\Local\Android\Sdk\tools\bin
Related
I have installed Appium 2.0 using command line but unable to see the appium-webdriveragent folder under /usr/local/lib/node_modules/appium/node_modules/ path (no folder found which is starts with appium).
Theses are the following commands I ran:
npm install -g appium#next
brew install Carthage
npm install -g appium-doctor
appium --base-path /wd/hub
appium driver install xcuitest
appium plugin install images
appium plugin install execute-driver
appium plugin install relaxed-caps
This is the appium version:
~ % appium -v
2.0.0-beta.46
This is the driver installed location:
~ % npm ls -g appium-webdriveragent
/usr/local/lib
└── (empty)
I am using Xcode:
Version 14.1 (14B47b)
This is the execution failure log:
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65
xcodebuild error message:
. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
Host info: host: 'L0057s-MacBook-Pro.local', ip: 'fe80:0:0:0:1863:fbc8:e2f5:1313%en0'
Build info: version: '4.5.0', revision: 'fe167b119a'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '12.5.1', java.version: '18.0.1.1'
Driver info: io.appium.java_client.AppiumDriver
Command: [null, newSession {capabilities=[{appium:appName=XXXX APP, appium:automationName=XCUITest, browserName=, appium:deviceName=iPhone 6s, appium:newCommandTimeout=60, platformName=IOS, appium:platformVersion=15.7.1, appium:udid=0ee9ce6c7e262203d06348ed55de4e747cfaab75, appium:usePrebuiltWDA=true}], desiredCapabilities=Capabilities {appName: XXXX APP, automationName: XCUITest, browserName: , deviceName: iPhone 6s, newCommandTimeout: 60, platformName: IOS, platformVersion: 15.7.1, udid: XXXXXXXX1234..., usePrebuiltWDA: true}}]
Capabilities {}
have followed https://github.com/appium/appium
You could try this fix.
For me it didn't work and I had to go back to xcode 13.4.1 to have it working again...
I tried as well with Appium2 (2.0.0-beta.46) but, unfortunately, I had to go back to 1.22.3 and downgraded Xcode from 14.1 to 13.4.1
Try installing XCUITest via:
appium driver install xcuitest or appium driver update xcuitest
appium-webdriveragent folder is available in user's home directory as .appium or can be located via
echo "$(dirname "$(find "$HOME/.appium" -name WebDriverAgent.xcodeproj)")"
I have been trying to do the "Running SonarScanner from the Docker image" from the documentation"
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 4.6.0.2311
INFO: Java 11.0.11 AdoptOpenJDK (64-bit)
INFO: Linux 5.10.25-linuxkit amd64
INFO: User cache: /opt/sonar-scanner/.sonar/cache
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: Analyzing on SonarQube server 8.8.0
INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Load global settings
INFO: Load global settings (done) | time=63ms
INFO: Server id: BF41A1F2-AXkMJHXiUF2U87mzcajk
INFO: User cache: /opt/sonar-scanner/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=35ms
INFO: Load/download plugins (done) | time=1086ms
INFO: Process project properties
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 2.438s
INFO: Final Memory: 5M/20M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
ERROR: You must define the following mandatory properties for 'Unknown': sonar.projectKey
ERROR:
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
my guess is that the sonar-project.properties are not being picked up and I don't understand why not
docker run \
--rm \
--network=host \
-e SONAR_HOST_URL="http://127.0.0.1:9000/" \
-e SONAR_LOGIN="*token*" \
-v $(pwd)/idevops-crmservice:/root/src \
sonarsource/sonar-scanner-cli
when I try to searching for this issue, all I really get is to use
sonar-runner -Dsonar.projectKey=
but that does not help me since I need the sonar-project.properties to be picked up
im wanting to scan an entire folder and unsure on what to do.
I also have same problem. and the solution is either dont run it on docker.. or create a new docker myself. the docker image on its documentation doesnt provide any argument other than the sample that was given.
Operation System: Windows Server 2016 R2
I have a RAMDisk driver can be installed with "Add Legacy Hardware Wizard" (hdwwiz.exe) successfully. From the output of devcon hwids *, the device can be seen as below.
ROOT\UNKNOWN\0000
Name: RAMDrive [ QSoft ] Enterprise (x64)
Hardware IDs:
ramdriv
However, I need complete the installation via Ansible, hence hdwwiz.exe cannot be used. It has to be done via command line without interaction.
I tried several approaches and none of them works.
Approach I : DevCon.exe (Windows Device Console)
C:\Ramdisk64_inst>devcon.exe install RAMDriv.inf ramdriv
Device node created. Install is complete when drivers are installed...
Updating drivers for ramdriv from C:\Ramdisk64_inst\RAMDriv.inf.
devcon.exe failed.
C:\Ramdisk64_inst>devcon.exe install RAMDriv.inf ROOT\UNKNOWN\0000
Device node created. Install is complete when drivers are installed...
Updating drivers for ROOT\UNKNOWN\0000 from C:\Ramdisk64_inst\RAMDriv.inf.
devcon.exe failed.
Here is the log from C:\Windows\INF\setupapi.dev.log
>>> [Device Install (UpdateDriverForPlugAndPlayDevices) - ramdriv]
>>> Section start 2018/12/20 07:10:35.670
cmd: C:\Ramdisk64_inst\devcon.exe install C:\Ramdisk64_inst\RAMDriv.inf ramdriv
ndv: INF path: C:\Ramdisk64_inst\RAMDriv.inf
ndv: Install flags: 0x00000001
! ndv: Unable to find any matching devices.
<<< Section end 2018/12/20 07:10:35.717
<<< [Exit status: FAILURE(0xe000020b)]
>>> [Device Install (UpdateDriverForPlugAndPlayDevices) - ROOT\UNKNOWN\0000]
>>> Section start 2018/12/20 07:11:50.687
cmd: devcon.exe install RAMDriv.inf ROOT\UNKNOWN\0000
ndv: INF path: C:\Ramdisk64_inst\RAMDriv.inf
ndv: Install flags: 0x00000001
! ndv: Unable to find any matching devices.
<<< Section end 2018/12/20 07:11:50.734
<<< [Exit status: FAILURE(0xe000020b)]
Approach 2 : DPInst.exe (Driver Package Installer)
C:\Ramdisk64_inst>dpinst.exe /PATH C:\Ramdisk64_inst /Q /C /LM
INFO: Option set: dumping log info to console.
INFO: Current working directory: 'C:\Ramdisk64_inst'
INFO: Running on path 'C:\Ramdisk64_inst'
INFO: No valid 'dpinst.xml' file provided.
INFO: Install option set: Running in quiet mode. Suppressing Wizard and OS popups.
INFO: Install option set: legacy mode on.
INFO: Found driver package: 'C:\Ramdisk64_inst\RAMDriv.inf'.
INFO: Preinstalling 'c:\ramdisk64_inst\ramdriv.inf' ...
INFO: ENTER: DriverPackagePreinstallW
INFO: Driver package is already preinstalled 'c:\ramdisk64_inst\ramdriv.inf'.
SUCCESS:c:\ramdisk64_inst\ramdriv.inf is preinstalled.
INFO: RETURN: DriverPackagePreinstallW (0xB7)
INFO: ENTER: DriverPackageGetPathW
INFO: RETURN: DriverPackageGetPathW (0x0)
INFO: ENTER: DriverPackageInstallW
WARNING:DRIVER_PACKAGE_LEGACY_MODE flag set but not supported on Plug and Play driver on VISTA. Flag will be ignored.
INFO: Installing INF file 'c:\ramdisk64_inst\ramdriv.inf' (Plug and Play).
INFO: Looking for Model Section [DiskDevice.NTamd64]...
INFO: No matching devices found in INF "C:\Windows\System32\DriverStore\FileRepository\ramdriv.inf_amd64_fcc99ac0622d865b\ramdriv.inf" on the Machine.
INFO: No drivers installed. No devices found that match driver(s) contained in 'C:\Windows\System32\DriverStore\FileRepository\ramdriv.inf_amd64_fcc99ac0622d865b\ramdriv.inf'.
INFO: RETURN: DriverPackageInstallW (0xE000020B)
INFO: No matching device was found for 'c:\ramdisk64_inst\ramdriv.inf'. Driver will be installed when plugged in.
INFO: Returning with code 0x100
Approach 3 : rundll32 calls SetupAPI
C:\Ramdisk64_inst>rundll32.exe setupapi.dll,InstallHinfSection DiskInstall 128 C:\Ramdisk64_inst\RAMDriv.inf
It ends without any error, but the driver is not installed.
Approach 4 : PnPUtil
C:\Ramdisk64_inst>pnputil.exe /add-driver C:\Ramdisk64_inst\RAMDriv.inf /install /subdirs /restart
Microsoft PnP Utility
Adding driver package: RAMDriv.inf
Driver package added successfully.
Published Name: oem7.inf
Driver package installed on matching devices.
Total driver packages: 1
Added driver packages: 1
It succeeded, but in fact driver is not installed.
None of them works. DpInst.exe says No matching devices found in INF, DevCon.exe says Unable to find any matching devices. It seems the same reason.
However the driver can be installed with hdwwiz.exe manually, does anyone know what is the secret inside hdwwiz.exe?
Legacy Drivers can´t be installed with pnputil and have to use LaunchINFSectionEx-Call
I tested the following and it works with several drivers from Windows 2000 up to Windows 10, 2012R2, 2016, 2019.
rundll32.exe advpack.dll,LaunchINFSectionEx ykmd.inf,Yubico64_Install.NT,,4,N
Pay attention to use the correct section
The correct section of the inf-File must be used, when there is no [DefaultInstall]-Section. This lacks in most answers. Look it up in your drivers inf-File and use the correct section (in my example "Yubico64_Install.NT"). Using the wrong section wont prompt an error. Im my example I use Quiet mode, no UI (4) and Never reboot (N) to install the driver automated via GPO. All options are documented in detail here:
https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/aa768006(v%3Dvs.85)
I am running SonarQube server v6.4 with v6.1 of the C# plugin. We have v3.0.0 of the SonarQube TFS extension installed in our TFS 2015 (Update 3) instance.
I am having issues with SonarQube scanning .cs files. There are a few warnings in the output of a few build steps that I'm not entirely sure what to make of. I haven't been able to find much on the messages.
Visual Studio Build step output:
OverrideCodeAnalysisProperties:
Skipping FxCop analysis: the SonarQube ruleset does not exist. Ruleset: C:\BuildAgents\Agent-01\_work\111\.sonarqube\conf\\SonarQubeFxCop-cs.ruleset
SonarQube Scanner for MSBuild - End Analysis (new) step output:
I'm seeing this at the beginning of the output for the step...
SonarQube Scanner for MSBuild 3.0
Default properties file was found at C:\BuildAgents\Agent-01\tasks\SonarQubeScannerMsBuildBegin\3.0.0\SonarQubeScannerMsBuild\SonarQube.Analysis.xml
Loading analysis properties from C:\BuildAgents\Agent-01\tasks\SonarQubeScannerMsBuildBegin\3.0.0\SonarQubeScannerMsBuild\SonarQube.Analysis.xml
Post-processing started.
17:58:54.965 17:58:54.965 WARNING: Failed to find the code coverage command line tool. Possible cause: Visual Studio is not installed, or the installed version does not support code coverage.
WARNING: File is not under the project directory and cannot currently be analysed by SonarQube. File: C:\Users\TFS2015Build\AppData\Local\Temp\.NETFramework,Version=v4.5.2.SqlClrAttributes.cs, project: C:\BuildAgents\Agent-01\_work\111\s\FunProject.Db\FunProject.Db.sqlproj
SONAR_SCANNER_OPTS is not configured. Setting it to the default value of -Xmx1024m
Calling the SonarQube Scanner...
INFO: Scanner configuration file: C:\BuildAgents\Agent-01\tasks\SonarQubeScannerMsBuildBegin\3.0.0\SonarQubeScannerMsBuild\sonar-scanner-3.0.3.778\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: C:\BuildAgents\Agent-01\_work\111\.sonarqube\out\sonar-project.properties
INFO: SonarQube Scanner 3.0.3.778
INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
INFO: Windows Server 2012 R2 6.3 amd64
INFO: SONAR_SCANNER_OPTS=-Xmx1024m
INFO: User cache: C:\Users\TFS2015Build\.sonar\cache
INFO: Load global settings
INFO: Load global settings (done) | time=125ms
INFO: User cache: C:\Users\TFS2015Build\.sonar\cache
INFO: Load plugins index
INFO: Load plugins index (done) | time=0ms
INFO: Download sonar-csharp-plugin-6.1.0.2359.jar
INFO: Download sonar-python-plugin-1.8.0.1496.jar
INFO: Download sonar-java-plugin-4.11.0.10660.jar
INFO: Download sonar-flex-plugin-2.3.jar
INFO: Download sonar-scm-git-plugin-1.2.jar
INFO: Download sonar-xml-plugin-1.4.3.1027.jar
INFO: Download sonar-php-plugin-2.10.0.2087.jar
INFO: Download sonar-scm-svn-plugin-1.4.0.522.jar
INFO: Download sonar-javascript-plugin-3.1.1.5128.jar
INFO: SonarQube server 6.4.0
INFO: Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent)
INFO: Process project properties
INFO: Load project repositories
INFO: Load project repositories (done) | time=141ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=47ms
INFO: Load active rules
INFO: Load active rules (done) | time=281ms
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=78ms
INFO: Publish mode
...then I'm seeing a set of output like this for each project in my solution:
INFO: ------------- Scan FunProject.Shared
INFO: Load server rules
INFO: Load server rules (done) | time=156ms
INFO: Initializer GenericCoverageSensor
INFO: Initializer GenericCoverageSensor (done) | time=0ms
INFO: Base dir: C:\BuildAgents\Agent-01\_work\111\s\FunProject.Shared
INFO: Working dir: C:\BuildAgents\Agent-01\_work\111\.sonarqube\out\.sonar\mod13
INFO: Source paths: FunProjectFolder1/FunProjectClassFile1.cs, FunProjectFolder2/FunProjectClassFile2.cs, ... Properties/AssemblyInfo.cs, packages.config
INFO: Source encoding: UTF-8, default locale: en_US
INFO: Index files
INFO: Analyzer working directory does not exist
INFO: 12 files indexed
INFO: Quality profile for cs: Sonar way
INFO: Sensor C# [csharp]
INFO: Importing analysis results from C:\BuildAgents\Agent-01\_work\111\.sonarqube\out\FunProject.Shared_3389\output-cs
WARNING: WARN: Protobuf file not found: C:\BuildAgents\Agent-01\_work\111\.sonarqube\out\FunProject.Shared_3389\output-cs\encoding.pb
INFO: Importing Roslyn report
WARNING: WARN: Protobuf file not found: C:\BuildAgents\Agent-01\_work\111\.sonarqube\out\FunProject.Shared_3389\output-cs\metrics.pb
WARNING: WARN: Protobuf file not found: C:\BuildAgents\Agent-01\_work\111\.sonarqube\out\FunProject.Shared_3389\output-cs\token-type.pb
WARNING: WARN: Protobuf file not found: C:\BuildAgents\Agent-01\_work\111\.sonarqube\out\FunProject.Shared_3389\output-cs\symrefs.pb
WARNING: WARN: Protobuf file not found: C:\BuildAgents\Agent-01\_work\111\.sonarqube\out\FunProject.Shared_3389\output-cs\token-cpd.pb
INFO: Sensor C# [csharp] (done) | time=78ms
INFO: Sensor SonarJavaXmlFileSensor [java]
INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=0ms
INFO: Sensor Analyzer for "php.ini" files [php]
INFO: Sensor Analyzer for "php.ini" files [php] (done) | time=0ms
Is there something obvious that I'm missing?
Edit:
I am using Visual Studio Professional, so the warning about code coverage is caused by the fact that I do not have Visual Studio Enterprise installed on the build server.
Suggest you first try to analyze solution in the command line locally to see if it works.
Run your analysis by executing the following commands from the root directory of the project:
SonarQube.Scanner.MSBuild.exe begin /k:"org.sonarqube:sonarqube-scanner-msbuild" /n:"Project Name" /v:"1.0"
MSBuild.exe /t:Rebuild
SonarQube.Scanner.MSBuild.exe end
This will narrow down it's your environment issue or just related to your build definition settings.
According to the error message:
WARNING: Failed to find the code coverage command line tool. Possible
cause: Visual Studio is not installed, or the installed version does
not support code coverage.
Double check your VS edition on your build agent. Note: you need Visual Studio Enterprise edition for code coverage. Have a look at this page and expand the 'testing tools' section. Code coverage is only listed for the Enterprise edition.
Besides, you could also enable verbose Debug Mode with system.debug=true to get a more detail build log for troubleshooting.
I downgraded the C# plugin from 6.1 (build 2359) to 5.11 (build 1721), and the problem went away. There must be some issue with that release that was causing the issue.
I have a Jenkins project which start up Android emulator and run the connectedDebugAndroidTest gradle task.
The first time everything is fine, But the consecutive build will failed
due to:
com.android.builder.testing.api.DeviceException: No connected devices!
I think my emulator run up perfectly. Because every time I use adb devices check the emulator. But the connectedAndroidTest failed.
Started by upstream project "cp_demo" build number 62
originally caused by:
Started by user selab
[EnvInject] - Loading node environment variables.
Building on master in workspace /var/lib/jenkins/workspace/em
$ /opt/android-sdk-linux/tools/android list target
[android] Using Android SDK: /opt/android-sdk-linux
$ /opt/android-sdk-linux/platform-tools/adb start-server
* daemon not running. starting it now at tcp:5850 *
* daemon started successfully *
$ /opt/android-sdk-linux/platform-tools/adb start-server
[android] Starting Android emulator
$ /opt/android-sdk-linux/tools/emulator -engine classic -ports 5746,5747 -report-console tcp:5839,max=60 -prop persist.sys.language=en -prop persist.sys.country=US -avd hudson_en-US_160_WVGA_android-23_x86 -no-snapshot-load -no-snapshot-save -no-window -verbose -noaudio
WARNING: Force to use classic engine to support snapshot.
emulator: Android virtual device file at: /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.ini
emulator: virtual device content at /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd
emulator: virtual device config file: /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/config.ini
emulator: using core hw config path: /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/hardware-qemu.ini
emulator: Found AVD target API level: 23
emulator: Read property file at /opt/android-sdk-linux/system-images/android-23/default/x86//build.prop
emulator: No boot.prop property file found.
emulator: found skin 'WVGA800' in directory: /opt/android-sdk-linux/platforms/android-23/skins/
emulator: autoconfig: -skin WVGA800
emulator: autoconfig: -skindir /opt/android-sdk-linux/platforms/android-23/skins/
emulator: found skin-specific hardware.ini: /opt/android-sdk-linux/platforms/android-23/skins//WVGA800/hardware.ini
emulator: autoconfig: -kernel /opt/android-sdk-linux/system-images/android-23/default/x86//kernel-qemu
emulator: Target arch = 'x86'
emulator: Auto-config: -qemu -cpu qemu32
emulator: Auto-detect: Kernel image requires legacy device naming scheme.
emulator: Auto-detect: Kernel does not support YAFFS2 partitions.
emulator: autoconfig: -ramdisk /opt/android-sdk-linux/system-images/android-23/default/x86//ramdisk.img
emulator: Using initial system image: /opt/android-sdk-linux/system-images/android-23/default/x86//system.img
emulator: autoconfig: -data /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/userdata-qemu.img
emulator: autoconfig: -initdata /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/userdata.img
emulator: autoconfig: -cache /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/cache.img
emulator: autoconfig: -sdcard /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/sdcard.img
emulator: Increasing RAM size to 1024MB
emulator: VM heap size 48MB is below hardware specified minimum of 192MB,setting it to that value
emulator: System image is read only
emulator: autoconfig: -snapstorage /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/snapshots.img
emulator: GPU emulation is disabled
emulator: Found 2 DNS servers: 8.8.8.8 168.95.192.1
emulator: trying to load skin file '/opt/android-sdk-linux/platforms/android-23/skins//WVGA800/layout'
emulator: Found 2 DNS servers: 8.8.8.8 168.95.192.1
emulator: WARNING: Classic qemu does not support SMP. The hw.cpu.ncore option from your config file is ignored.
Content of hardware configuration file:
hw.cpu.arch = x86
hw.cpu.model = qemu32
hw.cpu.ncore = 2
hw.ramSize = 1024
hw.screen = multi-touch
hw.mainKeys = true
hw.trackBall = true
hw.keyboard = false
hw.keyboard.lid = false
hw.keyboard.charmap = qwerty2
hw.dPad = true
hw.gsmModem = true
hw.gps = true
hw.battery = true
hw.accelerometer = true
hw.audioInput = true
hw.audioOutput = true
hw.sdCard = true
hw.sdCard.path = /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/sdcard.img
disk.cachePartition = true
disk.cachePartition.path = /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/cache.img
disk.cachePartition.size = 66m
hw.lcd.width = 480
hw.lcd.height = 800
hw.lcd.depth = 16
hw.lcd.density = 160
hw.lcd.backlight = true
hw.gpu.enabled = false
hw.gpu.mode = (null)
hw.gpu.blacklisted = no
hw.initialOrientation = portrait
hw.camera.back = emulated
hw.camera.front = none
vm.heapSize = 192
hw.sensors.light = true
hw.sensors.pressure = true
hw.sensors.humidity = true
hw.sensors.proximity = true
hw.sensors.magnetic_field = true
hw.sensors.orientation = true
hw.sensors.temperature = true
hw.useext4 = true
kernel.path = /opt/android-sdk-linux/system-images/android-23/default/x86//kernel-qemu
kernel.newDeviceNaming = no
kernel.supportsYaffs2 = no
disk.ramdisk.path = /opt/android-sdk-linux/system-images/android-23/default/x86//ramdisk.img
disk.systemPartition.initPath = /opt/android-sdk-linux/system-images/android-23/default/x86//system.img
disk.systemPartition.size = 1280m
disk.dataPartition.path = /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/userdata-qemu.img
disk.dataPartition.size = 2g
disk.snapStorage.path = /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/snapshots.img
avd.name = hudson_en-US_160_WVGA_android-23_x86
.
emulator: CPU Acceleration: working
emulator: CPU Acceleration status: KVM (version 12) is installed and usable.
QEMU options list:
emulator: argv[00] = "/opt/android-sdk-linux/tools/emulator64-x86"
emulator: argv[01] = "-audio"
emulator: argv[02] = "none"
emulator: argv[03] = "-dns-server"
emulator: argv[04] = "8.8.8.8,168.95.192.1"
emulator: argv[05] = "-serial"
emulator: argv[06] = "null"
emulator: argv[07] = "-serial"
emulator: argv[08] = "null"
emulator: argv[09] = "-boot-property"
emulator: argv[10] = "persist.sys.language=en"
emulator: argv[11] = "-boot-property"
emulator: argv[12] = "persist.sys.country=US"
emulator: argv[13] = "-android-ports"
emulator: argv[14] = "5746,5747"
emulator: argv[15] = "-android-report-console"
emulator: argv[16] = "tcp:5839,max=60"
emulator: argv[17] = "-enable-kvm"
emulator: argv[18] = "-android-hw"
emulator: argv[19] = "/var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/hardware-qemu.ini"
emulator: argv[20] = "-append"
emulator: argv[21] = "qemu=1 androidboot.hardware=goldfish clocksource=pit android.qemud=1 console=0 console=0 android.checkjni=1 qemu.gles=0 ndns=2"
Concatenated QEMU options:
/opt/android-sdk-linux/tools/emulator64-x86 -audio none -dns-server 8.8.8.8,168.95.192.1 -serial null -serial null -boot-property persist.sys.language=en -boot-property persist.sys.country=US -android-ports 5746,5747 -android-report-console tcp:5839,max=60 -enable-kvm -android-hw /var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/hardware-qemu.ini -append 'qemu=1 androidboot.hardware=goldfish clocksource=pit android.qemud=1 console=0 console=0 android.checkjni=1 qemu.gles=0 ndns=2'
emulator: Starting QEMU main loop
emulator: registered 'boot-properties' qemud service
emulator: Using kernel serial device prefix: ttyS
emulator: AVD Name: hudson_en-US_160_WVGA_android-23_x86
emulator: Ramdisk image contains fstab.goldfish file
emulator: Found format of system partition: 'ext4'
emulator: Found format of userdata partition: 'ext4'
emulator: Found format of cache partition: 'ext4'
emulator: system partition format: ext4
emulator: nand_add_dev: system,size=0x50000000,file=/opt/android-sdk-linux/system-images/android-23/default/x86//system.img,pagesize=512,extrasize=0,readonly
emulator: userdata partition format: ext4
emulator: nand_add_dev: userdata,size=0x80000000,file=/var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/userdata-qemu.img,pagesize=512,extrasize=0
emulator: cache partition format: ext4
emulator: nand_add_dev: cache,size=0x4200000,file=/var/lib/jenkins/.android/avd/hudson_en-US_160_WVGA_android-23_x86.avd/cache.img,pagesize=512,extrasize=0
emulator: Adding boot property: 'dalvik.vm.heapsize' = '192m'
emulator: Adding boot property: 'qemu.sf.lcd_density' = '160'
emulator: Adding boot property: 'qemu.hw.mainkeys' = '1'
emulator: Adding boot property: 'qemu.sf.fake_camera' = 'back'
emulator: Found 2 DNS servers: 8.8.8.8 168.95.192.1
emulator: Kernel parameters: qemu=1 androidboot.hardware=goldfish clocksource=pit android.qemud=1 console=0 console=0 android.checkjni=1 qemu.gles=0 ndns=2
emulator: trying to find: /opt/android-sdk-linux/tools/bios.bin
emulator: trying to find: /opt/android-sdk-linux/tools/lib/pc-bios/bios.bin
emulator: trying to find: /opt/android-sdk-linux/tools/vgabios-cirrus.bin
emulator: trying to find: /opt/android-sdk-linux/tools/lib/pc-bios/vgabios-cirrus.bin
emulator: Adding boot property: 'persist.sys.language' = 'en'
emulator: Adding boot property: 'persist.sys.country' = 'US'
emulator: (android_emulation_setup) using custom adb server port 5850
emulator: ro.adb.qemud invalid or not found, API >= 16, defaulting ro.adb.qemud = 0
emulator: (setup_console_and_adb_ports) trying console port 5746, adb port 5747 (legacy: true)
emulator: (android_console_start) initializing on port 5746
emulator: sent '0012host:emulator:5747' to ADB server
emulator: WARNING: Requested adb port (5747) is outside the recommended range [5555,5586]. ADB may not function properly for the emulator. See -help-port for details.
emulator: Listening for console connections on port: 5746
emulator: Serial number of this emulator (for ADB): emulator-5746
emulator: trying to find console-report client on tcp:5839
emulator: trying to find console-report client on tcp:5839
emulator: trying to find console-report client on tcp:5839
emulator: trying to find console-report client on tcp:5839
emulator: trying to find console-report client on tcp:5839
emulator: trying to find console-report client on tcp:5839
emulator: console port number sent to remote. resuming boot
[android] Emulator reported that the console is available on port 5,746
[android] Waiting for emulator to finish booting...
emulator: android_hw_fingerprint_init: fingerprint qemud listen service initialized
emulator: Skipping metrics reporting: No user opt-in.
$ /opt/android-sdk-linux/platform-tools/adb -s emulator-5746 wait-for-device shell getprop init.svc.bootanim
emulator: _hwFingerprint_connect: connect finger print listen is called
emulator: got message from guest system fingerprint HAL
[android] Emulator reported that the startup process is 'stopped'
$ /opt/android-sdk-linux/platform-tools/adb -s emulator-5746 logcat -v time
[android] Attempting to unlock emulator screen
$ /opt/android-sdk-linux/platform-tools/adb -s emulator-5746 shell wm dismiss-keyguard
$ /opt/android-sdk-linux/platform-tools/adb -s emulator-5746 shell input keyevent 4
[android] Emulator is ready for use (took 29 seconds)
[em] $ /bin/sh -xe /tmp/hudson8096686309595310732.sh
+ /opt/android-sdk-linux/platform-tools/adb devices
List of devices attached
emulator-5746 device
+ sleep 10
+ cd /var/lib/jenkins/workspace/cp_demo/CompositeApp
+ ./gradlew connectedDebugAndroidTest
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to /opt/android-sdk-linux/ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
WARNING: WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Unrecognized dependency: 'com.wu-man:android-oauth-client:0.4.5' (type: 'arr', extension: 'arr')
WARNING: WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Unrecognized dependency: 'com.wu-man:android-oauth-client:0.4.5' (type: 'arr', extension: 'arr')
WARNING: WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Unrecognized dependency: 'com.wu-man:android-oauth-client:0.4.5' (type: 'arr', extension: 'arr')
WARNING: WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Unrecognized dependency: 'com.wu-man:android-oauth-client:0.4.5' (type: 'arr', extension: 'arr')
WARNING: WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Incremental java compilation is an incubating feature.
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to /opt/android-sdk-linux/ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
WARNING: WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debugAndroidTest as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debugAndroidTest as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library
:app:prepareComAndroidSupportDesign2301Library
:app:prepareComAndroidSupportMultidex101Library
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareComAndroidSupportSupportV42301Library
:app:prepareComGoogleAndroidGmsPlayServicesBase840Library
:app:prepareComGoogleAndroidGmsPlayServicesBasement840Library
:app:prepareComGoogleAndroidGmsPlayServicesPlus840Library
:app:prepareCompositeAppComlibraryDebugUnspecifiedLibrary
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:incrementalDebugJavaCompilationSafeguard
:app:javaPreCompileDebug
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
/var/lib/jenkins/workspace/cp_demo/CompositeApp/app/src/main/java/ntu/selab/lw/util/ClassUtilities.java:326: warning: non-varargs call of varargs method with inexact argument type for last parameter;
value = valueClass.getMethod("toString", parameters).invoke(valueObj, parameters);
^
cast to Object for a varargs call
cast to Object[] for a non-varargs call and to suppress this warning
/var/lib/jenkins/workspace/cp_demo/CompositeApp/app/src/main/java/ntu/selab/lw/util/ClassUtilities.java:335: warning: non-varargs call of varargs method with inexact argument type for last parameter;
return beanClass.getMethod(methodName, parameters).invoke(beanObj, parameters);
^
cast to Object for a varargs call
cast to Object[] for a non-varargs call and to suppress this warning
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 warnings
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:unzipJacocoAgent UP-TO-DATE
:app:transformClassesWithJacocoForDebug
:app:transformClassesWithDexForDebug
Running dex as a separate process.
To run dex in process, the Gradle daemon needs a larger heap.
It currently has 1024 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to at least 2560 MB (based on the dexOptions.javaMaxHeapSize = 2g).
To do this set org.gradle.jvmargs=-Xmx2560M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html
:app:mergeDebugJniLibFolders UP-TO-DATE
:app:transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:app:validateSigningDebug
:app:packageDebug
:app:assembleDebug
:app:prepareComAndroidSupportMultidexInstrumentation101Library
:app:prepareComAndroidSupportRecyclerviewV72301Library
:app:prepareComAndroidSupportTestEspressoEspressoContrib221Library
:app:prepareComAndroidSupportTestEspressoEspressoCore221Library
:app:prepareComAndroidSupportTestEspressoEspressoIdlingResource221Library
:app:prepareComAndroidSupportTestExposedInstrumentationApiPublish041Library
:app:prepareComAndroidSupportTestRules041Library
:app:prepareComAndroidSupportTestRunner041Library
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl
:app:processDebugAndroidTestManifest
:app:compileDebugAndroidTestRenderscript
:app:generateDebugAndroidTestBuildConfig
:app:generateDebugAndroidTestResValues
:app:generateDebugAndroidTestResources
:app:mergeDebugAndroidTestResources
:app:processDebugAndroidTestResources
:app:generateDebugAndroidTestSources
:app:incrementalDebugAndroidTestJavaCompilationSafeguard
:app:javaPreCompileDebugAndroidTest
:app:compileDebugAndroidTestJavaWithJavacNote: /var/lib/jenkins/workspace/cp_demo/CompositeApp/app/src/androidTest/java/ntu/selab/lw/invoke/intent_address_extractor/OutputExtrasInputExtractorTest.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:app:compileDebugAndroidTestNdk UP-TO-DATE
:app:compileDebugAndroidTestSources
:app:mergeDebugAndroidTestShaders
:app:compileDebugAndroidTestShaders
:app:generateDebugAndroidTestAssets
:app:mergeDebugAndroidTestAssets
:app:transformClassesWithDexForDebugAndroidTest
:app:mergeDebugAndroidTestJniLibFolders
:app:transformNativeLibsWithMergeJniLibsForDebugAndroidTest
:app:processDebugAndroidTestJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebugAndroidTest
:app:validateSigningDebugAndroidTest
:app:packageDebugAndroidTest
:app:assembleDebugAndroidTest
:app:connectedDebugAndroidTest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:connectedDebugAndroidTest'.
> com.android.builder.testing.api.DeviceException: No connected devices!
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 5.205 secs
Build step 'Execute shell' marked build as failure
[android] Stopping Android emulator
[android] Archiving emulator log
$ /opt/android-sdk-linux/platform-tools/adb kill-server
Finished: FAILURE
The Build log display that my emulator startup successfully, Does anybody no why?
Thanks