MonkeyRunner无法使用startActivity

时间:2015-06-13 11:45:00

标签: android monkeyrunner

以下是我的AndroiManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.helloworld"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="21" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

我想使用monkeyrunner启动我的应用程序,但是当我发出命令时

device.startActivity(component='com.exmaple.helloworld/com.example.helloworld.MainActivity')

它无法启动我的应用。我错过了什么。我看了Issues using monkeyrunner startActivity,但它仍无效。

3 个答案:

答案 0 :(得分:0)

  

device.startActivity(组分=&#39; com.exmaple.helloworld / com.example.helloworld.MainActivity&#39)

您是否尝试过修改拼写错误(exmaple而不是示例)?

device.startActivity(component='com.example.helloworld/com.example.helloworld.MainActivity')

答案 1 :(得分:0)

您是否尝试过device.startActivity(component ='com.exmaple.helloworld / .MainActivity')?

答案 2 :(得分:0)

您应该在清单中更改活动名称:

android:name=".MainActivity"

android:name="com.example.helloworld.MainActivity"

然后你的脚本就可以了。

相关问题