What is the meaning of this error and how to resolve it. Please anyone let me know solution.

I have copied stacktrace as -

java.lang.NullPointerException
at android.test.InstrumentationTestCase.launchActivityWithIntent(InstrumentationTestCase.java:117)
at android.test.InstrumentationTestCase.launchActivity(InstrumentationTestCase.java:97)
at android.test.ActivityInstrumentationTestCase2.getActivity(ActivityInstrumentationTestCase2.java:104)
at com.WhatsApp.test.StartWhatsAppApp.setUp(StartWhatsAppApp.java:34)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1661)

You need to be a member of Mobile QA Zone to add comments!

Join Mobile QA Zone

Email me when people reply –

Replies

  • I have checked the CODE it's fine.

    Seems to be Instrumentation is not connecting with the app launcher.

    Please Try with creating new Project and clear all existing projects.

    • Did two to three times but didn't work.

  • Ho wto resolve this error .

    My AndroidManifest.XML is

    <?xml version="1.0" encoding="utf-8"?>

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.WhatsApp.test"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-sdk android:minSdkVersion="8" />
    <supports-screens android:anyDensity="true" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.RUN_INSTRUMENTATION" />
    <uses-permission android:name="android.permission.READ_USER_DICTIONARY" />
    <instrumentation
    android:name="android.test.InstrumentationTestRunner"
    android:targetPackage="com.WhatsApp" />
    <instrumentation
    android:name="pl.polidea.instrumentation.PolideaInstrumentationTestRunner"
    android:targetPackage="com.WhatsApp" />
    <application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:keepScreenOn="true"
    android:label="@string/app_name" >
    <uses-library android:name="android.test.runner" />
    </application>
    </manifest>

    My Code is :-

    package com.WhatsApp.test;

    import com.jayway.android.robotium.solo.Solo;

    import android.test.ActivityInstrumentationTestCase2;

    @SuppressWarnings("rawtypes")
    public class StartWhatsAppApp extends ActivityInstrumentationTestCase2
    {

    private Solo solo = null;
    private static final String LAUNCHER_ACTIVITY_CLASS_NAME = "com.WhatsApp.Main";
    private static Class LAUNCHER_ACTIVITY_CLASS;

    static
    {
    try
    {
    LAUNCHER_ACTIVITY_CLASS = Class.forName(LAUNCHER_ACTIVITY_CLASS_NAME);
    }
    catch (ClassNotFoundException e)
    {
    e.printStackTrace();
    }
    }
    @SuppressWarnings("unchecked")
    public StartWhatsAppApp() {
    super(LAUNCHER_ACTIVITY_CLASS);
    }

    @Override
    protected void setUp() throws Exception {
    super.setUp();
    solo = new Solo(getInstrumentation(), getActivity());
    }

    @SuppressWarnings("unchecked")
    public void testStartWhatsApp() throws InterruptedException {
    solo.waitForActivity(LAUNCHER_ACTIVITY_CLASS);
    Thread.sleep(1000);
    assertTrue(solo.searchText("WhatsApp"));;
    }

    @Override
    public void tearDown() throws Exception {
    solo.finishOpenedActivities();

    }
    }

  • Crash

This reply was deleted.
Welcome to Mobile QA Zone, a Next Generation Software Testing Community.Invite your friends to join this community.Write to us to become a featured member.