React-native: Attempt to invoke interface method 'boolean android.view.inputmethod.InputConnection.finishComposingText()' on a null object reference

Created on 16 Apr 2018  路  19Comments  路  Source: facebook/react-native

Hey there,

here's a crash we received in Bugsnag from on of our production devices:

java.lang.NullPointerException Attempt to invoke interface method 'boolean android.view.inputmethod.InputConnection.finishComposingText()' on a null object reference 
    InputConnectionWrapper.java:78 android.view.inputmethod.InputConnectionWrapper.finishComposingText
    InputMethodManager.java:852 android.view.inputmethod.InputMethodManager.reportFinishInputConnection
    ViewRootImpl.java:3523 android.view.ViewRootImpl$ViewRootHandler.handleMessage_aroundBody0
    ViewRootImpl.java:1 android.view.ViewRootImpl$ViewRootHandler$AjcClosure1.run
    ViewRootImplAO.java:82 android.view.ViewRootImplAO.ajc$around$android_view_ViewRootImplAO$3$dffdddeproceed
    ViewRootImplAO.java:87 android.view.ViewRootImplAO.ajc$around$android_view_ViewRootImplAO$3$dffddde
    ViewRootImpl.java:3341 android.view.ViewRootImpl$ViewRootHandler.handleMessage
    Handler.java:102 android.os.Handler.dispatchMessage
    Looper.java:148 android.os.Looper.loop
    ActivityThread.java:5585 android.app.ActivityThread.main
    Method.java:-2 java.lang.reflect.Method.invoke
    ZygoteInit.java:730 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
    ZygoteInit.java:620 com.android.internal.os.ZygoteInit.main

Steps to reproduce:

Looks like the user was just editing an TextInput field, and then tried to change the input method,
here's a breadcrumb we received in bugsnag milliseconds before the crash:

input_method_id: com.lge.ime/.LgeImeImpl
Intent Action: android.intent.action.INPUT_METHOD_CHANGED

and here's the exact text the client had been typing:

field: notes value: Told customer 9am - 1pm. We will give a 30 minute heads up phone call before arriving
Bosch power cord recall in Huxley in Hartford

The device where this happened was an LG LGUK750 running Android 6.0.1 (API 23)

Environment:
OS: macOS Sierra 10.12.6
Node: 8.4.0
Yarn: 1.5.1
npm: 5.3.0
Watchman: 4.7.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.53.3 => 0.53.3

Android Locked

Most helpful comment

This happened to me because of _Advanced Profiling_ option is enabled.
To disable the advanced profiling, follow these steps:

  1. Select Run > Edit Configurations.
  2. Select your app module in the left pane.
  3. Click the Profiling tab, and then uncheck Enable advanced profiling.
    Learn more
    screen shot 2018-05-07 at 10 47 00 am

All 19 comments

Thanks for posting this! It looks like your issue may refer to an older version of React Native. Can you reproduce the issue on the latest release, v0.55?

Thank you for your contributions.

We have not updated to 0.55 yet, and I'm not sure how to actually reproduce the issue.

This has happened to me as too. There was no input when this happened. It was in an emulator. It works fine with API 26 and above. It happens when configuration changes portrait to landscape and vise versa. Here is the error produced:
java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.view.inputmethod.InputConnection.finishComposingText()' on a null object reference
at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:362)
at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:78)
at android.os.Handler.dispatchMessage(Handler.java:102)
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)

This happened to me because of _Advanced Profiling_ option is enabled.
To disable the advanced profiling, follow these steps:

  1. Select Run > Edit Configurations.
  2. Select your app module in the left pane.
  3. Click the Profiling tab, and then uncheck Enable advanced profiling.
    Learn more
    screen shot 2018-05-07 at 10 47 00 am

After I tried, the problem was solved. Thank you very much

You're welcome!

This sounds like a solution for the dev version of the app, but we received that issue from a production app..

@Chivorns thank you

You're welcome bro

Thank you very much. It worked bro

welcome bro

@Chivorns thank you

@SudoPlz also had this error in production

Don't think this should have been closed

It would be very nivce, if a message which will said something like: "Check if Advanced Profile is enabled, if it is, then disable it", will pop up....

Thank you very much! It helped me a lot!

Same issue. any work around?

      This sounds like a solution for the dev version of the app, but we received that issue from a production app..

Chivorns solution solved the problem.

A fix has been submitted and will be in Android Studio 3.2

https://issuetracker.google.com/issues/77764953

I haven't enabled the avanced profiling, but encounter the same issue.

10-30 20:34:22.545 5970-5970/com.smartlifehousekeeper D/AndroidRuntime: Shutting down VM
10-30 20:34:22.549 5970-5970/com.smartlifehousekeeper E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.smartlifehousekeeper, PID: 5970
    java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.view.inputmethod.InputConnection.finishComposingText()' on a null object reference
        at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:150)
        at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:427)
        at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:85)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        at android.os.Looper.loop(Looper.java:171)
        at android.app.ActivityThread.main(ActivityThread.java:6699)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:246)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783)

my environment:

  React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
      CPU: x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
      Memory: 32.25 MB / 16.00 GB
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 8.11.3 - ~/.nvm/versions/node/v8.11.3/bin/node
      Yarn: 1.10.1 - /usr/local/bin/yarn
      npm: 6.4.1 - ~/.nvm/versions/node/v8.11.3/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
      Android SDK:
        Build Tools: 22.0.1, 23.0.1, 23.0.2, 23.0.3, 24.0.0, 24.0.1, 24.0.2, 24.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.2
        API Levels: 10, 14, 17, 19, 21, 22, 23, 24, 25, 26, 27, 28
    IDEs:
      Android Studio: 3.1 AI-173.4670197
      Xcode: 10.0/10A255 - /usr/bin/xcodebuild
    npmPackages:
      @types/react: ^16.4.16 => 16.4.18
      @types/react-native: ^0.57.4 => 0.57.7
      react: 16.5.0 => 16.5.0
      react-native: 0.57.2 => 0.57.2
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-create-library: 3.1.2
      react-native-git-upgrade: 0.2.7
      react-native-rename: 2.2.2
Was this page helpful?
0 / 5 - 0 ratings