我正在运行 Google TV 模拟器设备,在 Node 中具有以下功能:
config.capabilities = [
{
platformName: 'Android',
'appium:deviceName': 'Television_1080p_API_34',
'appium:platformVersion': '14.0',
'appium:orientation': 'LANDSCAPE',
'appium:automationName': 'UiAutomator2',
},
];
但是,我收到以下错误:
unknown error: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'com.myapp.androidtv' application.
Consider checking the driver's troubleshooting documentation.
Original error: Error executing adbExec. Original error: 'Command '/Users/myname/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am start -W -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000' exited with code 1';
Command output: Error: Intent matches multiple activities; can't stop: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 }
这里和 Appium 论坛中有解决方案,其中包括一个或两个:
'appium:appActivity': '.mainActivity',
'appium:appWaitActivity': '.mainActivity',
但我收到以下错误:
Original error: Activity name '.mainActivity' used to start the app doesn't exist or cannot be launched! Make sure it exists and is a launchable activity
此命令根本不会显示任何内容,因此不确定活动应该是什么:
adb shell dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'
我可以正常运行 Android TV 模拟器,可以看到应用程序并可以手动触发命令。
最初的错误不是很有帮助,但它是由于缺少:
'appium:appActivity': '.mainActivity'
由于我在使用
adb shell dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'
时没有获得任何值,因此我必须在 Android Studio 中打开 .apk 文件,然后找到 AndroidManifest.xml
文件并搜索 <activity> android:name
,您可以在其中找到用于加载应用程序的活动名称.