Search code examples
androidaspectjmonkeytalk

NullPointerException while using Monkeytalk tool


Hello I have implemented MonkeyTalk library in my app I used following steps given at https://www.gorillalogic.com/monkeytalk-documentation/monkeytalk-getting-started/install-agent/android.

Through these steps i am successfully able to record and playback steps in monkey talk IDE.

Now issue is when i use my app after installing the library it crashes randomly at several places giving NullPointerException. Log of one such incident is given below:

05-08 19:29:13.661: E/AndroidRuntime(27158): FATAL EXCEPTION: Thread-4790
05-08 19:29:13.661: E/AndroidRuntime(27158): java.lang.NullPointerException
05-08 19:29:13.661: E/AndroidRuntime(27158):    at com.gorillalogic.fonemonkey.ActivityManager$2.run(ActivityManager.java:112)
05-08 19:29:13.661: E/AndroidRuntime(27158):    at java.lang.Thread.run(Thread.java:856)

Any help to resolve the issue would be greatly appreciated.

I am using Eclipse Juno and Target SDK is 4.2 for development.


Solution

  • I got the same error when I tried to invoke another application (which does not have Monkey Talk Agent) from our application which is integrated with Monkey Talk Agent. So I have added a null pointer check in the monkey talk source code and that fixed the problem.

    ActivityManager.cjava - checkIsClipped() function:

    // Adding a null pointer check for the case where the application invokes another application that does not have
                // MonkeyTalk Agent integrated (for eg: Zxing barcode scanner). In this case the top activity would be null.                                
                catch (NullPointerException e) {                    
                    e.printStackTrace();
                }