I am an Appium and Android noob, thrown into a startup and asked to build their Appium testing for iOS and Android. I am having incredible trouble with Appium connections.
1: What does this error even mean?
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.truckpay.truckpay/com.truckpay.Activity.Activity_ScreenSlide } from null (pid=6246, uid=2000) not exported from uid 10150
at com.android.server.wm.ActivityStackSupervisor.checkStartAnyActivityPermission(ActivityStackSupervisor.java:1043)
at com.android.server.wm.ActivityStarter.startActivity(ActivityStarter.java:760)
at com.android.server.wm.ActivityStarter.startActivity(ActivityStarter.java:583)
at com.android.server.wm.ActivityStarter.startActivityMayWait(ActivityStarter.java:1288)
at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:514)
at com.android.server.wm.ActivityTaskManagerService.startActivityAndWait(ActivityTaskManagerService.java:1231)
at com.android.server.am.ActivityManagerService.startActivityAndWait(ActivityManagerService.java:3512)
at com.android.server.am.ActivityManagerShellCommand.runStartActivity(ActivityManagerShellCommand.java:513)
at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:172)
at android.os.ShellCommand.exec(ShellCommand.java:104)
at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:9774)
at android.os.Binder.shellCommand(Binder.java:881)
at android.os.Binder.onTransact(Binder.java:765)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:4498)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2741)
at android.os.Binder.execTransactInternal(Binder.java:1021)
at android.os.Binder.execTransact(Binder.java:994)
2: These are the solutions I have tried/looked at:
- Everything on this page and related pages. Android - java.lang.SecurityException: Permission Denial: starting Intent
- This guy’s solution: https://www.abdallahyashir.com/how-i-solve-permission-denial-error-starting-intent-when-running-appium-on-an-android-emulator/
I saw something saying that the app activity and package might be wrong but I found them while running the app’s initial page using
mCurrentFocus=Window{e28bfc5 u0 com.truckpay.truckpay/com.truckpay.Activity.Activity_ScreenSlide}
Here is the code, I’m getting the same error with and without the app part commented out:
// webdriverio is an automation FrameWork built to automate applications - Helps create a scalable, robust and stable test suite
const wdio = require("webdriverio");
// The assert module provides a way of testing expressions. If the expression evaluates to 0, or false, an assertion failure is being caused, and the program is terminated.
const assert = require("assert");
// Desired Capabilities are just a set of keys and values that get sent to the Appium server during session initialization, that tell Appium what kind of thing we want to automate.
// DESIRED CAPABILITIES:
const opts = {
path: '/wd/hub',
port: 4723,
capabilities: {
platformName: "android",
platformVersion: "10",
deviceName: "Pixel4",
// app: "/Users/christianfortin/Desktop/TRUCKPAY/android/android-official-new/app",
// app: "/data/app/com.truckpay.truckpay-wgEmERr3YM5Q32mK_1krSw==/base.apk=com.truckpay.truckpay",
// app: "/Users/christianfortin/Desktop/TRUCKPAY/android/android-official-new/app/build/outputs/apk/debug/app-debug.apk",
appPackage: "com.truckpay.truckpay",
// appPackage is for java for androids
appActivity: "com.truckpay.Activity.Activity_ScreenSlide",
// appActivity: Where to go in the app initially
automationName: "UiAutomator2",
// automationName: the name of the driver you wish to use
remoteAppsCacheLimit: "0",
}
};
async function main () {
const client = await wdio.remote(opts);
// Puts your phone and the application into the variable "client"
// const field = await client.$("android.widget.EditText");
// // Opens the "Edit text" application
// await field.setValue("Hello World!");
// Type this into the field
// const value = await field.getText();
// // This puts the value into a variable
// assert.strictEqual(value,"Hello World!");
// // This checks value against the value we expect it to give us
// await client.deleteSession();
// // This ends the session
}
main();