Original error: Could not find 'aapt.exe' - appium-android

I am having hte below error when i try to open an app using appium
org.openqa.selenium.SessionNotCreatedException: Unable to create a new
remote session. Please check the server log for more details. Original
error: An unknown server-side error occurred while processing the
command. Original error: Could not find 'aapt.exe' in
["C:\Users\nsingh163\Desktop\Naresh Folder\Automation\Mobile
Automation\Downloads\Android-sdk\platform-tools\aapt.exe","C:\Users\nsingh163\Desktop\Naresh Folder\Automation\Mobile
Automation\Downloads\Android-sdk\emulator\aapt.exe","C:\Users\nsingh163\Desktop\Naresh
Folder\Automation\Mobile
Automation\Downloads\Android-sdk\tools\aapt.exe","C:\Users\nsingh163\Desktop\Naresh
Folder\Automation\Mobile
Automation\Downloads\Android-sdk\tools\bin\aapt.exe"]. Do you
have Android Build Tools installed at
'C:\Users\nsingh163\Desktop\Naresh Folder\Automation\Mobile
Automation\Downloads\Android-sdk'? Build info: version: '3.141.59',
revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host:
'USD4FWTN2', ip: '10.88.4.6', os.name: 'Windows 10', os.arch: 'amd64',
os.version: '10.0', java.version: '1.8.0_171' Driver info:
driver.version: AndroidDriver
I have tried installing Android SDK again but still not able to find aapt.exe in hte tools folder

I am quite new to the mobile automation but I encountered this issue and how I managed to fix it...
aapt.exe is actually not in the "tools" folder :), you have to get "build-tools" folder and there you can find it
in cmd or whatever you are using, you can enter this command (bare in mind that the version is just as an example, I think that it has to match platform-tools you installed previously)
sdkmanager "build-tools;28.0.0"
So, once you have the build-tools folder, just go there and copy aapt.exe from there to the "tools" folder

To resolve this issue, below are the steps:
1. Find API level for your phone/ device. Setting -> About device -> Software Info -> Note down Android Version. -> Goto https://en.wikipedia.org/wiki/Android_version_history
from here, find out API Level for your Android Version.
2. Navigate to sdkmanager.bat path in CMD (\sdk-tools-windows-4333796\tools\bin) and use "sdkmanager "build-tools;21.0.0" to download build-tools for API level 21, change it as per your API level.
3. Once done, copy aapt.exe file from build-tools folder to platform-tools folder.
This should resolve the issue.

Related

getting an error on trying to launch Chrome using Protractor

I'm trying to launch the browser through Protractor. I downloaded webdriver through terminal by giving webdriver-manager update command. This is downloading the latest chromedriver v74, but the chrome browser is v73.
How to explicitly set the WebDriver version?
I'm getting the following error:
[11:09:13] E/driverProvider - Error code: 135
[11:09:13] E/driverProvider - Error message: session not created: This version of ChromeDriver only supports Chrome version 74
[11:09:13] E/driverProvider - Error: session not created: This version of ChromeDriver only supports Chrome version 74
(Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729#{#29}),platform=Mac OS X 10.14.2 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.70 seconds
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'Acsahs-MBP', ip: 'fe80:0:0:0:45:3f89:2e8b:ab96%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.2', java.version: '1.8.0_191'
Driver info: driver.version: unknown
at Local.<anonymous> (/usr/local/lib/node_modules/protractor/built/driverProviders/driverProvider.js:69:23)
at Generator.throw (<anonymous>)
at rejected (/usr/local/lib/node_modules/protractor/built/driverProviders/driverProvider.js:5:65)
at processTicksAndRejections (internal/process/next_tick.js:81:5)
[11:09:13] E/launcher - Process exited with error code 135
My config file:
exports.config = {
seleniumaddress:'http://localhost:4444/wd/hub',
specs:['spec.js']
};
is it solved yet? if not then try this.
for my small selenium-webdriver test i did these steps after i researched online and here:
npm install selenium-webdriver
npm install chromedriver
npm install geckodriver and opened file library.js and npm init and ran node library.js (source code below)
Error: (node:14212) UnhandledPromiseRejectionWarning: NoSuchSessionError: invalid session id Some long error related to not same chromedriver version. so i checked the chrome browser version manually in the browser. it was version 73 and my mistake i had downloaded chromedriver version 74.0.
so go to https://chromedriver.storage.googleapis.com/index.html?path=73.0.3683.68/ download according to your OS and download it in ~/Downloads .
then in open terminal in the ~/Downloads folder.
then USER#DESKTOP:~/Downloads$ unzip ~/Downloads/chromedriver_linux64.zip -d ~/Downloads You will get the raw chromedriver file in ~/Downloads folder.
now i moved the ChromeDriver 73.0.3683.68 file to two places - usr/local/bin and usr/bin in my system.
there was already a chromedriver file in usr/local/bin .
to move the file - USER#DESKTOP:~/Downloads$ sudo mv -f ~/Downloads/chromedriver /usr/local/bin/chromedriver and USER#DESKTOP:~/Downloads$ sudo mv -f ~/Downloads/chromedriver /usr/bin/chromedriver you are saying you want to move the file chromedriver from first location to other means replacing any files already in those locations with same name.
Last all i did was. close the vscode and relaunched it. and ran my code node library.js . and it worked it the chrome browser for me.
TOOK AN HOUR FOR ME TO GO THROUGH AROUND 35-40 STACK-OVERFLOW AND RANDOM ONLINE RESOURCES/QUESTION-ANSWERS BUT WAS WORTH IT. :)
SOURCE CODE : LIBRARY.JS
var webdriver = require('selenium-webdriver');
var By = webdriver.By;
var until = webdriver.until;
var driver = new webdriver.Builder().forBrowser('chrome').build();
driver.get('https://www.google.com');
Add this as a script to your package.json file
"scripts": {
"protactorInstall": "cd ./node_modules/protractor && npm i webdriver-manager#latest"}
use
npm run protactorInstall
to execute the script.
Try the below command from terminal to install particular version
webdriver-manager update --versions.chrome 2.46
Hope it helps you

Mac and "PANIC: Missing emulator engine program for 'arm' CPU."

I am attempting to run an AVD I have created for API 16 on a Galaxy Nexus:
emulator #Galaxy_Nexus_Jelly_Bean_API_16
which gives the error
PANIC: Missing emulator engine program for 'arm' CPU.
Attempting to start it by pressing the play button from the AVD Manager inside Android Studio bounces something briefly in the tool dock, but it quickly vanishes and nothing shows up and there are no obvious error messages.
I have looked through other posts with similar problems. Most cite Avast on Windows as causing the issue. I am running on a Mac. I do not have Avast installed.
The AVD has the following configuration:
Name: Galaxy_Nexus_Jelly_Bean_API_16
CPU/ABI: Google APIs ARM (armeabi-v7a)
Path: /Users/prisoner/.android/avd/Galaxy_Nexus_API_16.avd
Target: google_apis [Google APIs] (API level 16)
Skin: galaxy_nexus
SD Card: 100 MB
hw.dPad: no
hw.lcd.height: 1280
runtime.network.speed: full
hw.accelerometer: yes
hw.device.name: Galaxy Nexus
vm.heapSize: 80
skin.dynamic: yes
hw.device.manufacturer: Google
hw.lcd.width: 720
hw.gps: yes
hw.initialOrientation: Portrait
image.androidVersion.api: 16
hw.audioInput: yes
image.sysdir.1: add-ons/addon-google_apis-google-16/images/armeabi-v7a/
hw.cpu.model: cortex-a8
tag.id: google_apis
showDeviceFrame: yes
hw.camera.back: virtualscene
hw.mainKeys: no
AvdId: Galaxy_Nexus_Jelly_Bean_API_16
hw.camera.front: emulated
hw.lcd.density: 320
avd.ini.displayname: Galaxy Nexus Jelly Bean API 16
hw.arc: false
hw.gpu.mode: auto
hw.device.hash2: MD5:5c288d27461585ecc73a535555e7cf61
hw.ramSize: 1024
hw.trackBall: no
PlayStore.enabled: false
fastboot.forceColdBoot: no
hw.battery: yes
hw.cpu.ncore: 4
hw.sdCard: no
tag.display: Google APIs
runtime.network.latency: none
hw.keyboard: yes
hw.sensors.proximity: yes
disk.dataPartition.size: 800M
hw.sensors.orientation: yes
avd.ini.encoding: UTF-8
hw.gpu.enabled: yes
Android Studio environment:
Android Studio 3.1.4
Build #AI-173.4907809, built on July 23, 2018
JRE: 1.8.0_152-release-1024-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.6
I have installed everything for this version of the SDK available in the SDK Manager:
I have the latest version of the emulator installed. I've tried uninstalling and re-installing it.
The ANDROID_HOME environment variable appears to be correctly set (it matches the Android SDK location in the SDK Manager. The emulator program appears to be the one under this home environment as well:
Mulan:~ prisoner$ echo $ANDROID_HOME
/Users/prisoner/Library/Android/sdk
Mulan:~ prisoner$ which emulator
/Users/prisoner/Library/Android/sdk/tools/emulator
As far as I can tell, the emulator and the architecture-specific emulators are also under ANDROID_HOME:
I'm at a loss about where else to look, either for error messages or the emulator that is there, but can't be found by the system, or how else to address the problem.
Update 1: Specify path explicitly.
Trying to specify the paths explicitly doesn't work either:
Mulan:~ prisoner$ /Users/prisoner/Library/Android/sdk/tools/emulator #Galaxy_Nexus_Jelly_Bean_API_16
PANIC: Missing emulator engine program for 'arm' CPU.
Mulan:~ prisoner$ /Users/prisoner/Library/Android/sdk/emulator/emulator #Galaxy_Nexus_Jelly_Bean_API_16
emulator: ERROR: This AVD's configuration is missing a kernel file! Please ensure the file "kernel-qemu" is in the same location as your system image.
emulator: ERROR: ANDROID_SDK_ROOT is undefined
Sure enough, ANDROID_SDK_ROOT isn't defined. Defining it to the same thing as ANDROID_HOME does the following:
Mulan:~ prisoner$ export ANDROID_SDK_ROOT="$ANDROID_HOME"
Mulan:~ prisoner$ /Users/prisoner/Library/Android/sdk/emulator/emulator #Galaxy_Nexus_Jelly_Bean_API_16
emulator: ERROR: This AVD's configuration is missing a kernel file! Please ensure the file "kernel-qemu" is in the same location as your system image.
emulator: ERROR: ANDROID_SDK_ROOT is defined (/Users/prisoner/Library/Android/sdk) but cannot find kernel file in /Users/prisoner/Library/Android/sdk/system-images/ sub directories
Looking underneath the system-images directory, we see a directory for each API platform:
Mulan:~ prisoner$ ls ~/Library/Android/sdk/system-images/
android-16 android-19 android-23 android-26
android-17 android-21 android-24 android-27
android-18 android-22 android-25 android-28
Looking just under the android-16 directory, we have
./default
./default/armeabi-v7a
./default/armeabi-v7a/build.prop
./default/armeabi-v7a/kernel-qemu
./default/armeabi-v7a/NOTICE.txt
./default/armeabi-v7a/package.xml
./default/armeabi-v7a/ramdisk.img
./default/armeabi-v7a/source.properties
./default/armeabi-v7a/system.img
./default/armeabi-v7a/userdata.img
./default/mips
./default/mips/build.prop
./default/mips/kernel-qemu
./default/mips/NOTICE.txt
./default/mips/package.xml
./default/mips/ramdisk.img
./default/mips/source.properties
./default/mips/system.img
./default/mips/userdata.img
./default/x86
./default/x86/build.prop
./default/x86/kernel-qemu
./default/x86/kernel-ranchu
./default/x86/NOTICE.txt
./default/x86/package.xml
./default/x86/ramdisk.img
./default/x86/source.properties
./default/x86/system.img
./default/x86/userdata.img
./google_apis
./google_apis/x86
./google_apis/x86/advancedFeatures.ini
./google_apis/x86/build.prop
./google_apis/x86/kernel-qemu
./google_apis/x86/kernel-ranchu
./google_apis/x86/NOTICE.txt
./google_apis/x86/package.xml
./google_apis/x86/ramdisk.img
./google_apis/x86/source.properties
./google_apis/x86/system.img
./google_apis/x86/userdata.img
Just tried and verified on my Mac, to solve this problem, you need to specify the -kernel path manually. i.e.
$ ~/Library/Android/sdk/emulator/emulator #Galaxy_Nexus_Jelly_Bean_API_16 -kernel ~/Library/Android/sdk/system-images/android-16/default/armeabi-v7a/kernel-qemu
Some references for you:
Emulator error: This AVD's configuration is missing a kernel file
https://developer.android.com/studio/run/emulator-commandline
--- Edit ---
To avoid typing the -kernel argument every time, you can also copy the ~/Library/Android/sdk/system-images/android-16/default/armeabi-v7a/kernel-qemu file to ~/Library/Android/sdk/add-ons/addon-google_apis-google-16/images/armeabi-v7a.
Maybe it is the emulator tool path issue. Try to specify the full path of your emulator path.
Try the answer from here. Windows emulator.exe PANIC: Missing emulator engine program for 'x86' CPU
[Partial answer - to a related issue on the IDE]
I have faced this problem also. My Android Studio couldn't even start the emulator, coming up with an error like "Emulator: Process finished with exit code 1". The fix there was to install/update the relevant system images under SDK Manager -> SDK Platforms (tab) -> Click "Show Package Details" and then "Apply".
However, this doesn't seem to make the CLI command emulator -avd <avd name> run, instead I see the PANIC error, but apparently it's related to the migration of the emulator from the SDK path /tools to /emulator

Selenium shows java.net.SocketException: Connection reset

I have searched for the solution but I have not found the solution I always get this error
codigo :
public static void main(String [] args) {
System.setProperty("webdriver.chrome.driver","C:\\Users\\Ofima\\workspace\\OfimaWeb\\chromedriver.exe");
WebDriver driver= new ChromeDriver();
driver.get("http://ofimawebbeta.ofima.com/");
driver.manage().window().maximize();
driver.getTitle();
}
Error :
Starting ChromeDriver (v2.9.248315) on port 41785
ene 19, 2018 9:48:49 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFORMACIÓN: Detected dialect: OSS
Exception in thread "main" org.openqa.selenium.WebDriverException: java.net.SocketException: Connection reset
Build info: version: '3.8.0', revision: '924c4067df', time: '2017-11-30T11:37:19.049Z'
System info: host: 'PCPOF-021', ip: '10.72.4.128', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_151'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:92)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:325)
at OfimaWeb.cartera.main(cartera.java:23)
Caused by: java.net.SocketException: Connection reset
The error does gives us some hint as follows :
org.openqa.selenium.WebDriverException: java.net.SocketException: Connection reset
Which essentially implies that ChromeDriver binary is unable to spawn a new Chrome Browser process.
Your main issue is the version compatibility among the binaries you are using as follows:
You are using ChromeDriver v2.9 (released 2014-01-31)
Release Notes of ChromeDriver v2.9_ clearly mentions the following :
Supports Chrome v31-34
You mentioned of using latest Chrome. I suppose it is chrome=65.x
You are using Selenium Version 3.8.0 (released 2017-11-30T11:37:19.049Z) [as per the error stack trace within your question]
So there is a clear mismatch between requirement for ChromeDriver v2.9 and the Chrome Browser version you are using. Hence ChromeDriver is unable to spawn the new Chrome Browser process.
Solution
Update ChromeDriver to current v2.35 level.
Downgrade Chrome to stable Chrome v64.x levels. (as per ChromeDriver v2.35 release notes)
Upgrade Selenium to current levels Version 3.8.1.
Clean and Re-Build your project through your IDE.
Clear the Browser Cache
Use CCleaner tool to wipe off all the OS chores.
If your Web Browser base version is too old, uninstall the Web Browser through Revo Uninstaller with Moderate Scan and install a recent GA Released version of the Web Browser.
Execute your #Test.
Download ChromeDriver from
http://chromedriver.storage.googleapis.com/index.html?path=2.33/
This ChromeDriver shall work with your version of Google Chrome.

Getting "iDeviceInstaller" error even when ideviceinstaller is installed on my mac

I am using mac OSX El Capitan. I have installed eclipse Neon in it. I have a full setup of running selenium scripts using appium on real ios device. For this i have "ideviceinstaller" also installed. I created a project in a workspace to launch an app on the device and it is working fine. But when i copied the same code to different project, it starts giving me the error
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Could not initialize ideviceinstaller; make sure it is installed and works on your system) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 33.97 seconds
Build info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11 19:06:42'
System info: host: 'MacBookBL9138C.local', ip: '10.104.150.28', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '1.8.0_73'.
I tried by uninstalling the current eclipse and installing eclipse lunar, but its still failing. I tried running same code in new workspace, but still same error.
Any help will be appreciated.
I think i have found the answer for this one. I missed to configure the path in eclipse.
For refer the below link for answer:
https://discuss.appium.io/t/error-could-not-initialize-ideviceinstaller-make-sure-it-is-installed-and-works-on-your-system/11699/5?u=tuhuynh

Android studio:import NDK project from eclipse

I exported project from Eclipse(windows) and imported it to android studio V 0.4.2(ubuntu).
The project include working NDK library.
I get this error when try to run my app:
Execution failed for task ':app:compileDebugNdk'.
NDK not configured
From others stackoverflow posts, I understand that it is an issue.
But get no workaround for this.
Should i proceed the development with eclipse for now, or is that the a lazy option ?
EDIT :
I run this command:
export NDK=~/Downloads/android-ndk-r9c
and then :
and then go to my app directory and run this:
ndk-build
And i get this:
yarinkos-u#yarinkosu-MSI-Notebook-EX600:~/AndroidStudioProjects/AndEngineEXperimental$ ndk-build
/home/yarinkos-u/Downloads/android-ndk-r9c/ndk-build: 1: /home/yarinkos-u/Downloads/android-ndk-r9c/ndk-build: dirname: not found
/home/yarinkos-u/Downloads/android-ndk-r9c/ndk-build: 132: /home/yarinkos-u/Downloads/android-ndk-r9c/ndk-build: uname: not found
ERROR: Unknown host operating system:
What i did wrong?
It seems that the script running,but i miss something there.
EDIT 2:
i mistakenly runing this also :
export PATH=~/Downloads/android-ndk-r9c
so i get the error above.
If i running onlt this :
export NDK=~/Downloads/android-ndk-r9c
I get ndk-build not found error.
NDK Support is introduced from Android Studio 0.4.1 only, so make sure you are running AS 0.4.1 or above.
Android gradle plugin must be 0.7.+ in build.gradle file and also new NDK integration requires NDK r9c .
Lines from Developer tools blog under Release 0.4.1
Supports importing NDK projects. If the imported project contains NDK
sources, these are imported into the jni/ source set of the project,
the module name is inferred from the Makefile and stored in the Gradle
file, and the ndk.dir property is defined in local.properties.
Check more about it here :
http://tools.android.com/recent
you need to download the NDK for your operatings system # https://developer.android.com/tools/sdk/ndk/index.html once it's downloaded, install it it'll extract the contents to the correct file system it needs to be in it'll take some time, also make sure you are running the latest android studio. it worked for me. good luck.