Raghuram Vadapalli
Raghuram Vadapalli

Reputation: 1240

MonkeyRunner unable to use startActivity

The following is my 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>

I want to launch my app using monkeyrunner but when I give the command

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

It doesn't start my app. Am I missing anything. I read Issues using monkeyrunner startActivity but still it didn't work.

Upvotes: 2

Views: 507

Answers (4)

Lyn
Lyn

Reputation: 291

Add android:exported="true" line for the activity in AndroidManifest.xml file

Upvotes: 1

ivan.panasiuk
ivan.panasiuk

Reputation: 1259

You should change activity name in manifest, from:

android:name=".MainActivity"

to

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

then your script will work.

Upvotes: 0

lookatcn
lookatcn

Reputation: 1

Have you tried device.startActivity(component='com.exmaple.helloworld/.MainActivity')?

Upvotes: 0

sagarwadhwa1
sagarwadhwa1

Reputation: 942

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

have you tried fixing the typo (exmaple instead of example) ?

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

Upvotes: 0

Related Questions