简体   繁体   English

显示 Android 自动化错误:“安全异常:权限拒绝:启动意图”

[英]Android Automation Error Displayed: "Security exception: Permission Denial: starting Intent"

Tested multiple android native applications using appium/selenium automation script but none of the applications are getting opened and getting the following error message使用 appium/selenium 自动化脚本测试了多个 android 本机应用程序,但没有一个应用程序被打开并收到以下错误消息

Stderr: 'Security exception: Permission Denial: starting Intent from null (pid=20930, uid=2000) not exported from uid 10178' Stderr:'安全异常:权限拒绝:从空值(pid = 20930,uid = 2000)开始意图不是从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
        try 
        {
            AppiumDriver<MobileElement> driver = new AndroidDriver<MobileElement>(new URL("http://0.0.0.0:4723/wd/hub"), caps);
        } 
        catch (MalformedURLException e) 
        {
            System.out.println(e.getMessage());
        }

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 .网上很少有解决方案说要在AndroidManifest.xml编辑导出字段。 Where this File would be found?在哪里可以找到这个文件?

Appium Version - 1.10.0 Java - JDK 1.8 Appium 版本 - 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 = true -> 广播接收器能够从应用程序外部的源接收消息

  • android:exported = false ->broadcast receiver is only able to receive message from the app itself android:exported = false ->broadcast Receiver 只能接收来自应用程序本身的消息

You can add the exported attribute inside the <activity> element tag in the AndroidManifest.xml file like below:您可以在 AndroidManifest.xml 文件中的<activity>元素标签内添加exported属性,如下所示:

 <activity android:name=".MainActivity"
        android:exported="true"> 
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
 </activity>

You will get this kind of error when you try to launch the appActivity that is not main Activity.当您尝试启动不是主 Activity 的 appActivity 时,您会收到此类错误。

You must put the main appActivity in your desired capability.您必须将主 appActivity 放在您想要的功能中。

I also get the similar problem when the developer added the splash screen in the app and changed the main app activity.当开发人员在应用程序中添加启动画面并更改主应用程序活动时,我也遇到了类似的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 React Native 错误:“权限被拒绝:启动 Intent” - React Native Error: 'Permission Denial: starting Intent" 安全异常:权限被拒绝 - Security Exception: Permission Denial java.lang.SecurityException:权限被拒绝:启动 Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] - java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] java.lang.SecurityException:权限拒绝:启动意图{act = android.settings.USAGE_ACCESS_SETTINGS} - java.lang.SecurityException: Permission Denial: starting Intent {act=android.settings.USAGE_ACCESS_SETTINGS} 错误:java.lang.SecurityException:权限拒绝:以另一种方式启动Intent - Error: java.lang.SecurityException: Permission Denial: starting Intent with another flavor 如何通过Admob安全例外阻止adob中的广告客户:权限拒绝 - How to block an advertiser in admob because of Admob Security Exception : Permission Denial 解决 SecurityException: Permission Denial: 启动 Intent。 我需要什么许可? - Solve SecurityException: Permission Denial: starting Intent. What permission do I need? 拒绝参与外部活动的意图 - Permission Denial for intent to external activity Android Studio权限拒绝 - Android Studio Permission Denial android 工作室中的权限拒绝 - permission denial in android studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM