Call to method has too many arguments

I added a parameter to the Notifier.ShowTextDialog method, and now I am getting an error that the call to this method has too many arguments. How can I check where this method is getting called from so that I can investigate this problem further?

Delete the block and then add it again.

The error still appears.

Then error is in the source.
Method has been declared to accept 4 parameters but somehow 5 parameters are getting passed.
Try with online version.

@Alan_Abreu Since it sounds like you've changed the signature of ShowTextDialog, you'll need to recompile both the companion and the website, e.g., ant PlayApp noplay. The code on the phone has the 5 arguments but since the website hasn't been update it still thinks there are only 4 and sends only 4, resulting in the error.

I did that and I am still getting the error. What I am confused on is that I added the fourth parameter to ShowTextDialog, where it previously had only three. Now according to the error message the call to the ShowTextDialog method is trying to send in five arguments. If previously it had to send in three arguments to work, why is now suddenly sending in five?

What does the method signature look like in the Java code?

public void ShowTextDialog(String message, String title, String defaultText, boolean cancelable)

Did you reinstall the companion? The signature shown in the error is:

Notifier.ShowTextDialog(java.lang.String,java.lang.String,boolean)

but your signature has 3 strings and a boolean. Note, the extra argument is the this argument, i.e., Notifier1.

The fact that there are only 2 strings and 1 boolean in the signature coming from the companion and 3 strings and 1 boolean in the Java suggests to me that you need to install the latest build of the companion from your sources.

I am currently trying to install a new companion from my sources, but ADB does not recognize my android device. On the USB settings on the android device I have PTP on.

Did you enable developer mode?

It was on, I just needed to turn on USB debugging. Now ADB detects my device and after building with ant PlayApp noplay and installing the companion it says Success but nothing was actually installed on my android device.

You should see the MIT Ai2 Companion listed in the apps at this point. Depending on the version of Android you may need to swipe up to see all of the apps.

You are right it was located farther down in the list of apps. I am used to iPhones so I assumed it would just appear on the home screen. My change to ShowTextDialog now works as I intended. Thank you.

1 Like