简体   繁体   English

Appium 无法在具有多个活动的 Android 模拟器上启动

[英]Appium fails to launch on Android emulator with multiple activities

I'm using我在用着

  • Appium v1.22.2 Appium v​​1.22.2
  • IntelliJ community IntelliJ 社区
  • Gradle with dependencies带有依赖项的 Gradle
    implementation 'io.appium:java-client:7.6.0' testImplementation 'junit:junit:4.13.1' implementation 'org.assertj:assertj-core:3.22.0'实施 'io.appium:java-client:7.6.0' testImplementation 'junit:junit:4.13.1' 实施 'org.assertj:assertj-core:3.22.0'

Can you please help me to start an application via Appium on Android Emulator with multiple activities?您能帮我在 Android 模拟器上通过 Appium 启动一个具有多个活动的应用程序吗?

I couldn't get ahold of the concept of App_Wait_Activity and was trying to find the best suitable activity.我无法理解 App_Wait_Activity的概念,并试图找到最合适的活动。 While looking at Appium logs, it says that appium found the best match which is presentation.onboarding.OnboardActivity .在查看 Appium 日志时,它说 appium 找到了最佳匹配,即presentation.onboarding.OnboardActivity When I choose this activity the application launches and quits, and there are errors.当我选择此活动时,应用程序启动并退出,并且出现错误。 (See the error log below) (请参阅下面的错误日志)

I also checked AndroidManifest.xml on Android Studio and there are multiple activities coming from top to bottom as:我还检查了 Android Studio 上的 AndroidManifest.xml 并且从上到下有多个活动:

  1. android:name=".presentation.splash.StartActivity" android:name=".presentation.splash.StartActivity"
  2. android:name=".presentation.onboarding.OnboardActivity" android:name=".presentation.onboarding.OnboardActivity"
  3. android:name=".presentation.splash.SplashActivity" android:name=".presentation.splash.SplashActivity"
  4. android:name=".MainActivity" android:name=".MainActivity"
  5. android:name=".presentation.custom_view.widgets.WidgetsActivity" android:name=".presentation.custom_view.widgets.WidgetsActivity"

The error log with chosen App_activity as .presentation.onboarding.OnboardActivity .选择App_activity 作为 .presentation.onboarding.OnboardActivity的错误日志。

https://res.cloudinary.com/newslettergs/image/upload/v1657776487/Screen_Shot_2022-07-14_at_11.25.13_diutcy.png https://res.cloudinary.com/newslettergs/image/upload/v1657776487/Screen_Shot_2022-07-14_at_11.25.13_diutcy.png

    org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'app_package_name' 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/baizhan/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am start -W -n app_package_name/app_package_name.presentation.onboarding.OnboardActivity -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000' exited with code 255'; Command output: Security exception: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=app_package_name/.presentation.onboarding.OnboardActivity } from null (pid=10838, uid=2000) not exported from uid 10151

java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=app_package_name/.presentation.onboarding.OnboardActivity } from null (pid=10838, uid=2000) not exported from uid 10151
    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)

I am not able to see automationName in your capabilities.我无法在您的功能中看到automationName You can follow this guide.您可以按照指南进行操作。

You can also follow this to setup your appActivity or appWaitActivity你也可以按照这个来设置你的appActivityappWaitActivity

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM