• 11

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

Tested multiple android native applications using appium/selenium automation script but none of the applications are getting opened and getting the following error message

Stderr: 'Security exception: Permission Denial: starting Intent from null (pid=20930, uid=2000) not exported from uid 10178'

The Desired capabilities are set correctly but none of the apps are getting opened.

DesiredCapabilities caps = new DesiredCapabilities();
        caps.setCapability("deviceName", "Mobile");
        caps.setCapability("udid", "520042c3b5e5"); 
        caps.setCapability("platformName", "Android");
        caps.setCapability("platformVersion", "8.0.0"); 
        caps.setCapability("appPackage", "in.amazon.mShop.android.shopping");
        caps.setCapability("appActivity", "com.amazon.mShop.home.web.MShopWebGatewayActivity");
        caps.setCapability("noReset", "true");          

        //Instantiate Appium Driver
            AppiumDriver<MobileElement> driver = new AndroidDriver<MobileElement>(new URL(""), caps);
        catch (MalformedURLException e) 

Amazon mobile application should get opened but Security exception: Permission Denial error message is displayed.

Tried for other native apps by changing app package and activity and still getting the same error for all the apps tried.

There are few solutions online which says to edit an export field in AndroidManifest.xml. Where this File would be found?

Appium Version - 1.10.0 Java - JDK 1.8

From the official documentation this what the exported attribute does if:

  • android:exported = true -> The broadcast receiver is able to receive messages from sources outside the app

  • android:exported = false ->broadcast receiver is only able to receive message from the app itself

You can add the exported attribute inside the <activity> element tag in the AndroidManifest.xml file like below:

 <activity android:name=".MainActivity"
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
  • 1
Reply Report
      • 2
    • I am not able to locate the AndroidManifest.xml. could you please guide me in locating the file? Should this update be done for each app separately or in a single common file which will be applicable for all the applications.
      • 2
    • The AndroidManifest.xml file is located at the root of every app project. This needs to be done for each app separately.
      • 2
    • Thank you Bryan. Could that file be accessed from command prompt using adb command or is there some other way way to do that? I am yet to make an online search on this but still requesting you as well.
    • This would be appropriate if the app was yours, since you could find it inside your project. I have not tried this with an application from another developer since you would have recompile. However, if you have the .apk file in a computer, you could rename it to a .zip file and extract the files there. After, you will see the AndroidManifest.xml file. Hope this helps

You will get this kind of error when you try to launch the appActivity that is not main Activity.

You must put the main appActivity in your desired capability.

I also get the similar problem when the developer added the splash screen in the app and changed the main app activity.

  • 0
Reply Report
    • you can use adb shell dumpsys package | grep -i " (enter package name) " | grep Activity command to find the main activity. you need to run your app after writing the script
      • 1
    • Thank you so much. I opened the app in android studio in debug mode to find main activity from AndroidManifest.xml. The issue issue resolved now.