I need to take some screen shots, is it possible to use the method 'takeScreenShot' already available in Robotium to take screen shots? I've imported the jar files, but I haven't been too successful. If it is not possible to use robotium can you suggest any other solutions.
public class MyService extends Service {
Solo solo;
Context con;
private Instrumentation it;
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
it = new Instrumentation();
Log.i("My Service", "Instrumentation Obj was created");
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// TODO Auto-generated method stub
solo = new Solo(it);
if(solo == null)
Log.i("My Service", "Solo Obj was created");
solo.takeScreenshot();
return super.onStartCommand(intent, flags, startId);
}
Log cat O/P: 03-06 17:27:54.939: W/dalvikvm(1405): VFY: unable to resolve new-instance 468 (Lcom/jayway/android/robotium/solo/Solo;) in Lcom/example/unboundserviceex/MyService; 03-06 17:27:54.949: D/dalvikvm(1405): VFY: replacing opcode 0x22 at 0x0000 03-06 17:27:54.949: D/dalvikvm(1405): DexOpt: unable to opt direct call 0x0cf0 at 0x04 in Lcom/example/unboundserviceex/MyService;.onStartCommand 03-06 17:27:54.949: I/My Service(1405): Instrumentation Obj was created 03-06 17:27:54.959: D/AndroidRuntime(1405): Shutting down VM 03-06 17:27:54.959: W/dalvikvm(1405): threadid=1: thread exiting with uncaught exception (group=0x409c01f8) 03-06 17:27:54.979: E/AndroidRuntime(1405): FATAL EXCEPTION: main
03-06 17:27:54.979: E/AndroidRuntime(1405): java.lang.NoClassDefFoundError:
com.jayway.android.robotium.solo.Solo 03-06 17:27:54.979: E/AndroidRuntime(1405): at com.example.unboundserviceex.MyService.onStartCommand(MyService.java:33) 03-06 17:27:54.979: E/AndroidRuntime(1405): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2359) 03-06 17:27:54.979: E/AndroidRuntime(1405): at android.app.ActivityThread.access$1900(ActivityThread.java:123) 03-06 17:27:54.979: E/AndroidRuntime(1405): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210) 03-06 17:27:54.979: E/AndroidRuntime(1405): at android.os.Handler.dispatchMessage(Handler.java:99) 03-06 17:27:54.979: E/AndroidRuntime(1405): at android.os.Looper.loop(Looper.java:137) 03-06 17:27:54.979: E/AndroidRuntime(1405): at android.app.ActivityThread.main(ActivityThread.java:4424) 03-06 17:27:54.979: E/AndroidRuntime(1405): at java.lang.reflect.Method.invokeNative(Native Method) 03-06 17:27:54.979: E/AndroidRuntime(1405): at java.lang.reflect.Method.invoke(Method.java:511) 03-06 17:27:54.979: E/AndroidRuntime(1405): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 03-06 17:27:54.979: E/AndroidRuntime(1405): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 03-06 17:27:54.979: E/AndroidRuntime(1405): at dalvik.system.NativeStart.main(Native Method)
The main error I believe is: java.lang.NoClassDefFoundError