Getting error while running Mobile automation script in appium - android

Getting error while running automation script in appium.
I am running a Mobile automation script on a Windows Desktop system with below software set up.
Software Set-Up:
1.Android Studio
2.Appium
3.Mobile/Tablet connected to the system
4.Selenium/Appium Driver code for Automation
Error
apksigner stderr: ERROR: Registry editing has been disabled by your administrator.
Exception in thread "main" java.nio.file.AccessDeniedException: C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk
Cannot use apksigner tool for signing. Defaulting to sign.jar. Original error: Command 'apksigner.bat sign --key 'C:\\Program Files\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-adb\\keys\\testkey.pk8' --cert 'C:\\Program Files\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-adb\\keys\\testkey.x509.pem' 'C:\\Program Files\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-uiautomator2-server\\apks\\appium-uiautomator2-server-debug-androidTest.apk'' exited with code 1; StdErr: ERROR: Registry editing has been disabled by your administrator.
[warn] [35m[ADB][39m Exception in thread "main" java.nio.file.AccessDeniedException: C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk
Unable to remove port forward 'Error executing adbExec. Original error: 'Command 'C\:\\Users\\Sumit.Chouhtel\\AppData\\Local\\Android\\sdk\\platform-tools\\adb.exe -P 5037 -s RFXTBIC00014974 forward --remove tcp\:8200' exited with code 1'; Stderr: 'adb.exe: error: listener 'tcp:8200' not found'; Code: '1''
[debug] [35m[BaseDriver][39m Event 'newSessionStarted' logged at 1568214375516 (20:36:15 GMT+0530 (India Standard Time))

Try to enable registry editing using these steps (assuming you have Windows 10)
Win + R (To open run commander window)
run gpedit.msc
Go to User Configuration > Administrative Templates > System > Prevent Access to Registry Editing Tools
Double click and set it to "disable"
Addition ways to achieve this https://www.techperiod.com/registry-edit-disabled-by-virus-fix/

I have got the below solution:
Need to click option as 'Only For Me' while installing the Appium Desktop app. (If we select 'For all users' option than there will be error in appium run).

Related

Firebase CLI appdistribution:distribute issue : nothing appens, no upload, no error

I'm currently trying to deploy apk to firebase apps distribution but we have a issue.
the command
firebase appdistribution:distribute appqualityrelease.apk –app xxxxxxxxxxxxxxxxxxxx ````
don't produce any output, it juste exit.
I'm correctly logged in using cli, app id is correct, apk is valid (it runs on simulator and physical device)
I also tried to use this command on our CI/CD environment (Azure Devops) with CI token,
All attempt produce the same issue : the command exit without error on the console (on DevOps, the message is Bash exited with code 1)
On Devops, we also try to run the deploy on Windows, Ubuntu, MacOs : same issue.
I also added the debug flag and there is only one error
[debug] [2023-01-13T07:55:33.894Z] ----------------------------------------------------------------------
[debug] [2023-01-13T07:55:33.896Z] Command: /usr/local/bin/node /usr/local/bin/firebase appdistribution:distribute appqualityrelease.apk –app xxxxxxxxxxxxxxxxxxxxxxxxxxx --debug
[debug] [2023-01-13T07:55:33.897Z] CLI Version: 11.20.0
[debug] [2023-01-13T07:55:33.897Z] Platform: darwin
[debug] [2023-01-13T07:55:33.897Z] Node Version: v16.17.1
[debug] [2023-01-13T07:55:33.898Z] Time: Fri Jan 13 2023 08:55:33 GMT+0100 (heure normale d’Europe centrale)
[debug] [2023-01-13T07:55:33.899Z] ----------------------------------------------------------------------
[debug]
[error]
[error] Error: Too many arguments. Run firebase help appdistribution:distribute for usage instructions
Could someone help us?

Starting session in Appium

While starting a session in Appium, I am getting below error:
Error:
An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: 'Command 'C:\Users\satyajit.more\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 install 'E:\Appium Setup\MobileInsurance_QA_16062018.apk'' exited with code 1'; Stderr: 'adb: failed to install E:\Appium Setup\MobileInsurance_QA_16062018.apk: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]'; Code: '1'
Have configured an emulator using the android studio, but am unable to install the app on the emulator, How can we resolve this?
The apk file you are trying to install is incompatible with the device hardware. You would get the same error even if you install the apk manually on the device. Check this thread for more information.

Cordova: adb: Command failed with exit code 255

I get this output/error when
cordova run android --target 0152a65c02a27d5b --verbose
Output
No scripts found for hook "before_run".
No scripts found for hook "before_prepare".
Checking config.xml for saved platforms that haven't been added to the project
Checking for any plugins added to the project that have not been installed in android platform
No differences found between plugins added to project and installed in android platform. Continuing...
Generating platform-specific config.xml from defaults for android at /Users/r00/Projects/myappGo/myapp_app/platforms/android/res/xml/config.xml
Merging project's config.xml into platform-specific android config.xml
Merging and updating files from [www, platforms/android/platform_www] to platforms/android/assets/www
Wrote out android application name "myapp" to /Users/r00/Projects/myappGo/myapp_app/platforms/android/res/values/strings.xml
Wrote out Android package name "com.myappgo.myapp" to /Users/r00/Projects/myappGo/myapp_app/platforms/android/src/com/myappgo/myapp/MainActivity.java
This app does not have launcher icons defined
This app does not have splash screens defined
Prepared android project successfully
No scripts found for hook "after_prepare".
Checking config.xml for saved plugins that haven't been added to the project
ANDROID_HOME=/Users/r00/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
Running command: /Users/r00/Projects/myappGo/myapp_app/platforms/android/gradlew cdvBuildDebug -b /Users/r00/Projects/myappGo/myapp_app/platforms/android/build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true
BUILD SUCCESSFUL
Total time: 1.695 secs
Command finished with error code 0: /Users/r00/Projects/myappGo/myapp_app/platforms/android/gradlew cdvBuildDebug,-b,/Users/r00/Projects/myappGo/myapp_app/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
Built the following apk(s):
/Users/r00/Projects/myappGo/myapp_app/platforms/android/build/outputs/apk/android-debug.apk
No scripts found for hook "before_deploy".
ANDROID_HOME=/Users/r00/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
Running command: adb devices
Command finished with error code 0: adb devices
Running command: adb devices
Command finished with error code 0: adb devices
Running adb shell command "cat /proc/cpuinfo" on target 0152a65c02a27d5b...
Running command: adb -s 0152a65c02a27d5b shell cat /proc/cpuinfo
Command finished with error code 0: adb -s,0152a65c02a27d5b,shell,cat,/proc/cpuinfo
Skipping build...
Built the following apk(s):
/Users/r00/Projects/myappGo/myapp_app/platforms/android/build/outputs/apk/android-debug.apk
Using apk: /Users/r00/Projects/myappGo/myapp_app/platforms/android/build/outputs/apk/android-debug.apk
Package name: com.myappgo.myapp
Installing apk /Users/r00/Projects/myappGo/myapp_app/platforms/android/build/outputs/apk/android-debug.apk on target 0152a65c02a27d5b...
Running command: adb -s 0152a65c02a27d5b install -r /Users/r00/Projects/myappGo/myapp_app/platforms/android/build/outputs/apk/android-debug.apk
Command finished with error code 255: adb -s,0152a65c02a27d5b,install,-r,/Users/r00/Projects/myappGo/myapp_app/platforms/android/build/outputs/apk/android-debug.apk
Error: adb: Command failed with exit code 255
at ChildProcess.whenDone (/Users/r00/Projects/myappGo/myapp_app/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:827:16)
at Socket.<anonymous> (internal/child_process.js:319:11)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at Pipe._onclose (net.js:486:12)
I'm quiet lost here
My fix was to delete a few apps.
The phone gave a hint; it kept popping-up a message that storage was low. However, I didn't think this was related to not being able to install the app (initially).
Connection: MTP (Media Device)
USB debugging: On
Device: LG Risio
Android version: 6.0
Cordova CLI: 6.5.0
Framework: Ionic 1.x
Ionic CLI: 2.2.1
Machine: Mac OS X Sierra
Node: 4.4.2
Extra details:
I kept switching between MTP and PTP connection. Restarted the device. And, I kept plugging and unplugging the device from my computer. Nothing worked. The build is always successful in the console. But somehow, the app just wasn't getting installed on the device. I deleted the old version of the app sometimes that can cause a problem where there are inconsistent versions. But that didn't work either. When I deleted 3 big apps from the phone and tried installing again cordova run android, the app was finally installed on the phone.
From you command line run
adb -s 0152a65c02a27d5b shell cat /proc/cpuinfo
and check whether it fails and how.
As
Running command: adb devices
Command finished with error code 0: adb devices
may have succeeded perhaps you specific device is not detected or cannot obtain cpuinfo.

Why do I need to drop to root to compile Cordova apps, which don't work?

I can't figure out why I can no longer build Android apps using Cordova on the same computer that I used to build the same apps that worked last month, after having updated Cordova and NodeJS.
Currently I'm having to utilize super user privileges to get as far as Cordova launching the emulator, but it is then unable to install the app on the emulator and subsequently crashes with the following error.
So first to root with
sudo -E su
Then the cordova command will launch the emulator without sudo
cordova emulate android
if I try cordova run android, I get nothing launching on the connected device. The following is the output after dropping to root then running the emulate command.
Running command: /home/lyndon/myapp/platforms/android/cordova/run --emulator
ANDROID_HOME=/home/lyndon/Software/android-sdk-linux
JAVA_HOME=/usr/lib/jvm/java-8-oracle/bin
WARNING : no emulator specified, defaulting to myavd
Waiting for emulator...
emulator: emulator window was out of view and was recentered
Booting up emulator (this may take a while)...................BOOT COMPLETE
Running: /home/lyndon/myapp/platforms/android/gradlew cdvBuildDebug -b /home/lyndon/myapp/platforms/android/build.gradle -PcdvBuildArch=arm -Dorg.gradle.daemon=true
ERROR: JAVA_HOME is set to an invalid directory: /usr/lib/jvm/java-8-oracle/bin
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
/home/lyndon/myapp/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /home/lyndon/myapp/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/lyndon/myapp/platforms/android/build.gradle,-PcdvBuildArch=arm,-Dorg.gradle.daemon=true
Error: /home/lyndon/myapp/platforms/android/cordova/run: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
I never previously had to drop to root to launch the Android emulator with Cordova, why is this currently the case and why is the app not installing on the emulator?

Android Emulator is running but not loading my app in Titanium

I can run the app in the "mobile app preview in browser", and I can boot up the Android Emulator successfully. But the emulator just showed me the home screen all the time without loading my app. I've looked through all the similar questions online but couldn't find a solution.
Here is the console...hope someone can help me out. Thanks!
*Titanium Command-Line Interface, CLI version 3.1.0, Titanium SDK version 3.1.0.GA
Copyright (c) 2012-2013, Appcelerator, Inc. All Rights Reserved.
[INFO] : Running emulator process: python "C:\Users\Ni\AppData\Roaming\Titanium\mobilesdk\win32\3.1.0.GA\android\builder.py" "emulator" "myFirstApp" "C:\Users\Ni\Android-sdk\adt-bundle-windows-x86\sdk" "C:\Users\Ni\Documents\Titanium_Studio_Workspace\myFirstApp" "com.yn.myFirstApp" "4" "HVGA" "armeabi"
[INFO] : Running build process: python "C:\Users\Ni\AppData\Roaming\Titanium\mobilesdk\win32\3.1.0.GA\android\builder.py" "simulator" "myFirstApp" "C:\Users\Ni\Android-sdk\adt-bundle-windows-x86\sdk" "C:\Users\Ni\Documents\Titanium_Studio_Workspace\myFirstApp" "com.yn.myFirstApp" "4" "HVGA"
[INFO] logfile = C:\Users\Ni\Documents\Titanium_Studio_Workspace\myFirstApp\build.log
[INFO] Building myFirstApp for Android ... one moment
[INFO] Titanium SDK version: 3.1.0 (04/15/13 18:45 57634ef)
[INFO] : Emulator process exited successfully
[INFO] : Project built successfully in 3s 24ms
[INFO] : Emulator not running, exiting...*
Don't know if you have solved this, but for the reference of others, you shouldn't run the emulator yourself, allow Titanium Studio to launch the emulator by simply running your application with the emulator option (like Martin says)
In my own experience, i'm able to run my app in the emulator, but for all subsequent runs, i need to close the emulator and run the app again since Studio fails to detect the emulator and gives me an error similar to yours.
I forgot to add an answer for this question...
I could successfully run the Titanium only when I choose "run as administrator".
When this happens, you can install the app manually.
You will find your app's executable in the following directory under your app directory: build/android/bin/YOURAPPNAME.apk. On the Mac, you need to open a terminal window, cd to that directory, and type "chmod 777 YOURAPPNAME.apk". Then cd to the platform-tools directory under your android sdk installation directory, and run the following commands:
./adb kill-server
./adb start-server
./adb install <full path name to YOURAPPNAME.apk>
You will see your app appear on the home screen of the emulator.
I made a shell script to do this.

Categories

Resources