csdn__YX 2019-11-04 17:17
浏览 1263

appium1.15.1连接安卓系统7.0以上的真机,打开非系统应用报安全错误,求解?

以下是打开应用的代码(python)。如果操作对象是系统应用,代码正常运行;如果操作的对象为用户安装的应用,代码报错

from appium import webdriver

desired_caps = dict()
#平台名:区分Android、ios
desired_caps['platformName'] = 'Android'
#平台版本:同连接设备上的(关于)安卓版本一致 (6.1.1版本,可填写6.1.1、6.1、6)
desired_caps['platformVersion'] = '9'
#设备名:ios需正确填写,安卓不为空则可以
desired_caps['deviceName'] = 'CLB7N18301000651'
#应用名:通过adb查看
desired_caps['appPackage'] = 'com.lefull.tenant'
#界面名:通过adb查看
desired_caps['appActivity'] = '.ui.TenantActivity'


#打开应用,进入指定页面
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)

运行非系统应用,代码报错

selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.lefull.tenant' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: Error executing adbExec. Original error: 'Command '/Users/moon/android-sdk-macosx/platform-tools/adb -P 5037 -s CLB7N18301000651 shell am start -W -n com.lefull.tenant/.ui.TenantActivity -S' exited with code 255'; Stderr: 'Security exception: Permission Denial: starting Intent { flg=0x10000000 cmp=com.lefull.tenant/.ui.TenantActivity } from null (pid=30377, uid=2000) not exported from uid 10163

java.lang.SecurityException: Permission Denial: starting Intent { flg=0x10000000 cmp=com.lefull.tenant/.ui.TenantActivity } from null (pid=30377, uid=2000) not exported from uid 10163
    at com.android.server.am.ActivityStackSupervisor.checkStartAnyActivityPermission(Landroid/content/Intent;Landroid/content/pm/ActivityInfo;Ljava/lang/String;IIILjava/lang/String;ZZLcom/android/server/am/ProcessRecord;Lcom/android/server/am/ActivityRecord;Lcom/android/server/am/ActivityStack;)Z(libmapleservices.so:4357457)
    at com.android.server.am.ActivityStarter.startActivity(Landroid/app/IApplicationThread;Landroid/content/Intent;Landroid/content/Intent;Ljava/lang/String;Landroid/content/pm/ActivityInfo;Landroid/content/pm/ResolveInfo;Landroid/service/voice/IVoiceInteractionSession;Lcom/android/internal/app/IVoiceInteractor;Landroid/os/IBinder;Ljava/lang/String;IIILjava/lang/String;IIILcom/android/server/am/SafeActivityOptions;ZZ[Lcom/android/server/am/ActivityRecord;Lcom/android/server/am/TaskRecord;Z)I(libmapleservices.so:4763781)
    at com.android.server.am.ActivityStarter.startActivity(Landroid/app/IApplicationThread;Landroid/content/Intent;Landroid/content/Intent;Ljava/lang/String;Landroid/content/pm/ActivityInfo;Landroid/content/pm/ResolveInfo;Landroid/service/voice/IVoiceInteractionSession;Lcom/android/internal/app/IVoiceInteractor;Landroid/os/IBinder;Ljava/lang/String;IIILjava/lang/String;IIILcom/android/server/am/SafeActivityOptions;ZZ[Lcom/android/server/am/ActivityRecord;Lcom/android/server/am/TaskRecord;Ljava/lang/String;Z)I(libmapleservices.so:4769313)
    at com.android.server.am.HwActivityStarter.startActivity(Landroid/app/IApplicationThread;Landroid/content/Intent;Landroid/content/Intent;Ljava/lang/String;Landroid/content/pm/ActivityInfo;Landroid/content/pm/ResolveInfo;Landroid/service/voice/IVoiceInteractionSession;Lcom/android/internal/app/IVoiceInteractor;Landroid/os/IBinder;Ljava/lang/String;IIILjava/lang/String;IIILcom/android/server/am/SafeActivityOptions;ZZ[Lcom/android/server/am/ActivityRecord;Lcom/android/server/am/TaskRecord;Ljava/lang/String;Z)I(libmaplehwServices.so:3322649)
    at com.android.server.am.ActivityStarter.startActivityMayWait(Landroid/app/IApplicationThread;ILjava/lang/String;Landroid/content/Intent;Ljava/lang/String;Landroid/service/voice/IVoiceInteractionSession;Lcom/android/internal/app/IVoiceInteractor;Landroid/os/IBinder;Ljava/lang/String;IILandroid/app/ProfilerInfo;Landroid/app/WaitResult;Landroid/content/res/Configuration;Lcom/android/server/am/SafeActivityOptions;ZILcom/android/server/am/TaskRecord;Ljava/lang/String;Z)I(libmapleservices.so:6583725)
    at com.android.server.am.ActivityStarter.execute()I(libmapleservices.so:4770265)
    at com.android.server.am.ActivityManagerService.startActivityAndWait(Landroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;Ljava/lang/String;Landroid/os/IBinder;Ljava/lang/String;IILandroid/app/ProfilerInfo;Landroid/os/Bundle;I)Landroid/app/WaitResult;(libmapleservices.so:6887257)
    at com.android.server.am.ActivityManagerShellCommand.runStartActivity(Ljava/io/PrintWriter;)I(libmapleservices.so:6994469)
    at com.android.server.am.ActivityManagerShellCommand.onCommand(Ljava/lang/String;)I(libmapleservices.so:7136029)
    at android.os.ShellCommand.exec(Landroid/os/Binder;Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;[Ljava/lang/String;Landroid/os/ShellCallback;Landroid/os/ResultReceiver;)I(libmapleframework.so:7202205)
    at com.android.server.am.ActivityManagerService.onShellCommand(Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;[Ljava/lang/String;Landroid/os/ShellCallback;Landroid/os/ResultReceiver;)V(libmapleservices.so:7192841)
    at android.os.Binder.onTransact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z(libmapleframework.so:4130721)
    at android.app.IActivityManager$Stub.onTransact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z(libmapleframework.so:4752437)
    at com.android.server.am.ActivityManagerService.onTransact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z(libmapleservices.so:5920045)
    at com.android.server.am.HwActivityManagerService.onTransact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z(libmaplehwServices.so:3379945)
    at android.os.Binder.execTransact(IJJI)Z(libmapleframework.so:6087833)'; Code: '255'
            在网络上查资料,发现全部的测试安卓系统都是5。如果想测试安卓7以上的系统,应该如何解决???
            谢谢!!
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Unity发布gzip压缩的webgl之后让浏览器可以正常显示画面
    • ¥15 有没有人知道这种提示怎么关?现在不做ts项目了不知道咋关了,求解,现在我以前的js项目都是这种提示了
    • ¥15 为什么mysql做了碎片化处理data_free还是很高
    • ¥15 single positional indexer is out-of-bounds
    • ¥15 LSTM 模型数据量需要多少?
    • ¥15 mysql数据抓包开发报表
    • ¥15 linux系统下安装office打不开
    • ¥20 rsync脚本分发错误,文件不齐全
    • ¥15 labview顺序结构与时间延时
    • ¥15 脚本求解,源于数据库脚本变量筛选。