mnotgod96 / AppAgent

AppAgent: Multimodal Agents as Smartphone Users, an LLM-based multimodal agent framework designed to operate smartphone apps.
https://appagent-official.github.io/
MIT License
5.1k stars 554 forks source link

adb shell input text error #34

Open madroidmaq opened 10 months ago

madroidmaq commented 10 months ago

Using adb shell input text will result in the following error message when multiple strings are entered into the text box:

adb -s emulator-5554 shell input text "app agent test"

The error message is as follows:

Exception occurred while executing 'text':
java.lang.NullPointerException: Attempt to get length of null array
        at com.android.server.input.InputShellCommand.sendText(InputShellCommand.java:319)
        at com.android.server.input.InputShellCommand.runText(InputShellCommand.java:291)
        at com.android.server.input.InputShellCommand.onCommand(InputShellCommand.java:232)
        at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
        at android.os.ShellCommand.exec(ShellCommand.java:38)
        at com.android.server.input.InputManagerService.onShellCommand(InputManagerService.java:3297)
        at android.os.Binder.shellCommand(Binder.java:1068)
        at android.os.Binder.onTransact(Binder.java:888)
        at android.hardware.input.IInputManager$Stub.onTransact(IInputManager.java:1339)
        at android.os.Binder.execTransactInternal(Binder.java:1344)
        at android.os.Binder.execTransact(Binder.java:1275)
wildwind0 commented 9 months ago

same error

twiceyuan commented 9 months ago
    def text(self, input_str):
        input_str = input_str.replace(" ", "%s")
        input_str = input_str.replace("'", "")
        adb_command = f"adb -s {self.device} shell input text {input_str}"
        ret = execute_adb(adb_command)
        return ret

I noticed that the project has implemented simple adaptations by replacing spaces and single quotes, and it works fine in my tests. I'm not sure if this is due to the input method?