vpedak/droidtestrec

Spinners cause runtime exception

Closed this issue · 5 comments

java.lang.RuntimeException: setOnItemClickListener cannot be used with a spinner.
at android.widget.Spinner.setOnItemClickListener(Spinner.java:559)
at com.vpedak.testsrecorder.core.AdapterViewProcessor.processView(AdapterViewProcessor.java:20)
at com.vpedak.testsrecorder.core.ActivityProcessor.processView(ActivityProcessor.java:96)
at com.vpedak.testsrecorder.core.ActivityProcessor.processView(ActivityProcessor.java:105)
at com.vpedak.testsrecorder.core.ActivityProcessor.processView(ActivityProcessor.java:105)
at com.vpedak.testsrecorder.core.ActivityProcessor.processView(ActivityProcessor.java:105)
at com.vpedak.testsrecorder.core.ActivityProcessor.processView(ActivityProcessor.java:105)
at com.vpedak.testsrecorder.core.ActivityProcessor.processView(ActivityProcessor.java:105)
at com.vpedak.testsrecorder.core.ActivityProcessor.processView(ActivityProcessor.java:105)
at com.vpedak.testsrecorder.core.ActivityProcessor.processView(ActivityProcessor.java:105)
at com.vpedak.testsrecorder.core.ActivityProcessor.processView(ActivityProcessor.java:105)
at com.vpedak.testsrecorder.core.ActivityProcessor.processView(ActivityProcessor.java:105)
at com.vpedak.testsrecorder.core.ActivityProcessor.access$100(ActivityProcessor.java:27)
at com.vpedak.testsrecorder.core.ActivityProcessor$1.run(ActivityProcessor.java:63)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Test running failed: Instrumentation run failed due to 'java.lang.RuntimeException'

new version 0.9.2 with the fix is uploaded to the plugins repositiry

Hi, I'm using the version 0.9.2 and I still have the same problem:

D/dalvikvm( 1617): Debugger has detached; object registry had 1 entries
E/AndroidRuntime( 1625): FATAL EXCEPTION: main
E/AndroidRuntime( 1625): java.lang.RuntimeException: setOnItemClickListener cannot be used with a spinner.
E/AndroidRuntime( 1625): at android.widget.Spinner.setOnItemClickListener(Spinner.java:427)
E/AndroidRuntime( 1625): at com.vpedak.testsrecorder.core.AdapterViewProcessor.processView(AdapterViewProcessor.java:20)
E/AndroidRuntime( 1625): at com.vpedak.testsrecorder.core.ActivityProcessor.processView(ActivityProcessor.java:107)
E/AndroidRuntime( 1625): at com.vpedak.testsrecorder.core.ActivityProcessor.processView(ActivityProcessor.java:116)
E/AndroidRuntime( 1625): at com.vpedak.testsrecorder.core.ActivityProcessor.processView(ActivityProcessor.java:116)
E/AndroidRuntime( 1625): at com.vpedak.testsrecorder.core.ActivityProcessor.processView(ActivityProcessor.java:116)
E/AndroidRuntime( 1625): at com.vpedak.testsrecorder.core.ActivityProcessor.processView(ActivityProcessor.java:116)
E/AndroidRuntime( 1625): at com.vpedak.testsrecorder.core.ActivityProcessor.processView(ActivityProcessor.java:116)
E/AndroidRuntime( 1625): at com.vpedak.testsrecorder.core.ActivityProcessor.processView(ActivityProcessor.java:116)
E/AndroidRuntime( 1625): at com.vpedak.testsrecorder.core.ActivityProcessor.processView(ActivityProcessor.java:116)
E/AndroidRuntime( 1625): at com.vpedak.testsrecorder.core.ActivityProcessor.processView(ActivityProcessor.java:116)
E/AndroidRuntime( 1625): at com.vpedak.testsrecorder.core.ActivityProcessor.access$000(ActivityProcessor.java:27)
E/AndroidRuntime( 1625): at com.vpedak.testsrecorder.core.ActivityProcessor$2.run(ActivityProcessor.java:80)
E/AndroidRuntime( 1625): at android.os.Handler.handleCallback(Handler.java:725)
E/AndroidRuntime( 1625): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 1625): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 1625): at android.app.ActivityThread.main(ActivityThread.java:5041)
E/AndroidRuntime( 1625): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1625): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 1625): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime( 1625): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime( 1625): at dalvik.system.NativeStart.main(Native Method)

If you upload the build.gradle files to make it easy to compile and create the .jar I can help to fix it...

Thanks

Hi,

This was my mistake... I did not realize that Spinner is instance of AdapterView and my previous fix was wrong. I've uploaded version with new fix to the site - http://droidtestlab.com/AndroidTestsRecorder.zip. Can you please try it (just uninstall plugin and install it from file, not from repository)? And if it is working I will commit the fix.

Thanks

Thanks @vpedak, it worked.
BTW, where can I find the build.gradle files to build the plugin by myself?

Thanks!

@mdvacca there is no build.gradle. Plugin is developed in Intelllij Idea itself, not in Android Studio and it is requires reference to some rare used libraries (including Idea liblaries itself), so I am not sure that it is easy to build it with gradle. I am using Idea itself to build it but dependency resolution is a big problem.