He everyone, I am getting this exception
java.lang.SecurityException: Permission Denial: android.intent.action.CLOSE_SYSTEM_DIALOGS
and Im not sure where its coming from as the app im testing doesnt use android.intent.action.CLOSE_SYSTEM_DIALOGS
anywhwere
Maybe it is a 3rd party library somewhere.
I disabled security exceptions with
adb shell monkey -p package.name --ignore-security-exceptions -v -v 15000
but it still throws the exception.
Any help with this will be appreciated, thank you for your time
There is likely a permission issue within the program "Monkey" itself in which, is conflicting with the Android permission system. It appears to be the same type of error that would occur in Windows if you tried to run a program that required administrative rights.
If possible, try running as admin.
Related
I'm having issues trying to run Frida on MacOS (12.3) to an android emulator (8.1).
I have downloaded 'frida-server-15.1.17-android-x86.xz' and put this on the emulator in /data/local/tmp.
I also made this executable with chmod +x and run it on the emulator.
Now i have objection and frida installed on my macbook and I'm trying to run frida-ps -Uai.
This is where I get the error as mentioned in the title.
Failed to enumerate applications: enumerate_applications() got an unexpected keyword argument 'scope'
Please if somebody knows the fix or a work around for this it would be greatly appreciated.
The installed frida-version and the version of frida-server should be the same. The error got an unexpected keyword argument indicates that you might use different (incompatible) versions.
Check frida-ps --version. It should output 15.1.17
Furthermore Frida has a bug that is unresolved for months that makes it impossible to use the app package name when connecting from command-line. Instead you have to use the app name or the process id shown in the output of frida-ps -Uai.
I'm using Appium to automate the tests of an Android app. Recently I stuck on an error while trying to test the behavior of the app when it gets pushed to background and relaunched again. I was lucky, that I found the method appiumDriver.runAppInBackground(Duration duration).
...But when I'm executing appiumDriver.runAppInBackground(Duration.ofSeconds(1)); I receive an exception.
I run the tests on an android Emulator (PIXEL_API_25) and I use Appium 1.7.2 with java_client 5.0.4, but in future, they should also run on iOS.
The appiumDriver variable is static (not sure if this could make a difference...).
Thank you for any help!
Meanwhile I've found a solution which works for me.
With updating Appium from 1.7.2 to 1.8.1 the issue is resolved.
Its pretty clear what went wrong in stacktrace:
Original error: 'Command ''C:\\Users\\User\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe' -P 5037 -s emulator-5554 shell am start -W -n de.abc.myApp/.BookingOverviewActivity' exited with code 1'; Stderr: 'java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=de.abc.myApp/.BookingOverviewActivity } from null (pid=7759, uid=2000) not exported from uid 10224
Appium failed to launch your app back from background because of permission restriction. Try with 5 seconds and different device.
If still reproduced: to fix it, you need to update you application source code with android:exported="true" in manifest file for BookingOverviewActivity activity.
When launching an app using adb command "am start intent.... ", I got an security exception stating that "java.lang.SecurityException: Permission Denial:", and the app doesn't get launched.
When I checked StackOverflow for solutions, I found solutions which are based on editing the manifest.xml file. I dont have any permissions to edit the file. Since am a user of that app and not a developer.
My questions are
1. Is there any way to escape this exception via adb commands. I need to escape this through commands, because its a third party app also I don't have access to manifest.xml file.
Else is there any other way to launch the app through adb command??
If you root your device you can gain root access/permissions by using su before your commands. This should prevent you from being denied due to permissions.
I thought it would be cool to turn the hardware button lights on when my application needs user attention so the user could get an indicator when the screen is blanked. As it turns out, this requires root access (echo 1 > /system/class/leds/keyboard-backlight/brightness). I found a link on Stack (http://muzikant-android.blogspot.com/2011/02/how-to-get-root-access-and-execute.html) to a class which tests for root access but it fails on my Nexus-S.
Is there a way to run shell commands as root without having to root the device?
Thanks
Edit: this is the error I'm getting from logcat
11-15 12:34:19.889: D/ROOT(2029): Root access rejected [java.io.IOException] : Error running exec(). Command: [su] Working Directory: null Environment: null
The reason it fails it because your phone needs to be rooted.
See the Wikipedia entry for Rooting (Android OS).
It would be a major security flaw if any app on any phone could take root and do anything.
If your phone has root access then you can fire shell scripts using Process and Runtime class..
We are currently working on an instrumentation test suite which runs on our build server, but while the tests pass on a dev machine using a normal Android emulator, the builds fail on the build server since there we only run a headless emulator with the -no-window flag.
The failure occurs when trying to invoke the InstrumentationTestCase.sendKeys() method to programmatically open the options menu. The error is:
Permission denied: injecting key event from pid 646 uid 10026 to window Window{43d55100 paused=false} owned by uid 1000
We then found out that there's a INJECT_EVENTS permission, but setting it in the manifest had no effect. In fact in the log we saw this output:
Not granting permission android.permission.INJECT_EVENTS to package com.qype.radar (protectionLevel=2 flags=0x6644)
Does that mean this permission is useless?
We also tried to let the instrumentation test app and the app under test share the same Linux user ID using android:sharedUserId and run in the same process (android:process -- we weren't sure if that was already the case), but still no luck.
Does this mean it's currently impossible to run instrumentations which contain key events on a headless emulator, or are we missing something?
I run the emulator without -no-window on headless machines by first running an Xvnc instance (i.e. fake X server) then starting the emulator in that DISPLAY.
More accurately, I get the Xvnc and Android Emulator Jenkins plugins to do this for me.
Unfortunately, unlocking the screen is still a concern before injecting UI events, but this is (hackily) resolved by automatically running a command like this (similar to this other answer you've seen):
echo "event send EV_KEY:KEY_MENU:1 EV_KEY:KEY_MENU:0" | nc -q1 localhost 5554
Edit:
I discovered that this method is far more reliable:
adb shell input keyevent 82
Some info about keycode 82.
I had similar problem with my test on the Hudson server. In my case the problem I solved by suggestion from Android SDK:
http://developer.android.com/guide/topics/testing/testing_android.html#UITestTroubleshooting
Important was that I had to enable permissions for main application too.