Test run failed: Instrumentation run failed due to 'java.lang.ClassNotFoundException'

1,470 views
Skip to first unread message

Sudheer NL

unread,
Dec 2, 2013, 7:55:23 AM12/2/13
to robotium-...@googlegroups.com
Hi,

I am trying to run a simple project to launch facebook native app on emulator with Android 4.3 on Windows 7, I am blocked with the same error as mentioned in below link, tried suggested solutions but it didn't work. Has anyone faced similar issue?





I have followed all the steps as mentioned in below link to setup the project (re-sign the apk with debug key, etc,..) https://code.google.com/p/robotium/wiki/RobotiumForAPKFiles

logcat error:

12-02 00:55:16.040: E/AndroidRuntime(1037): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.katana.LoginActivity" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/com.example.webview.test-2.apk", zip file "/data/app/com.example.webview-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.webview.test-2, /data/app-lib/com.example.webview-1, /system/lib]]




code:
package com.facebook.test;

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

public class FacebookNativeAppLoginTest extends
ActivityInstrumentationTestCase2 {

private static final String LAUNCHER_ACTIVITY_FULL_CLASSNAME = "com.facebook.katana.LoginActivity";
private static final String TARGET_PACKAGE_ID ="com.facebook.katana";
private static Class launcherActivityClass;

static {

try {
launcherActivityClass = Class
.forName(LAUNCHER_ACTIVITY_FULL_CLASSNAME);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}

@SuppressWarnings({ "unchecked", "deprecation" })
public FacebookNativeAppLoginTest() throws ClassNotFoundException {
super(launcherActivityClass);
}

private Solo solo;

@Override
protected void setUp() throws Exception {
// setUp() is run before a test case is started.
// This is where the solo object is created.
solo = new Solo(getInstrumentation(), getActivity());
}

@Override
public void tearDown() throws Exception {
// tearDown() is run after a test case has finished.
// finishOpenedActivities() will finish all the activities that have
// been opened during the test execution.
solo.finishOpenedActivities();
}


/**
* A test that searches for Robotium and asserts that Robotium is found.
*/
public void testNativeLoginFacebook() {
solo.sleep(3000);
solo.clearEditText(0);
solo.enterText(0, "login_signup");
// solo.enterText("login_username", "login_signup");

}

}


Android manifest file:

<?xml version="1.0" encoding="utf-8"?>
    package="com.facebook.test"
    android:versionCode="1"
    android:versionName="1.0" >

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

    <instrumentation
        android:name="android.test.InstrumentationTestRunner"
        android:targetPackage="com.facebook.katana" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <uses-library android:name="android.test.runner" />
    </application>

</manifest>


Thanks,



Sudheer te

unread,
Dec 19, 2013, 4:39:12 AM12/19/13
to robotium-...@googlegroups.com
The issue was due to the corrupted Facebook APK file, when I tried with the new apk file, issue is resolved.
Reply all
Reply to author
Forward
0 new messages