question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android crashes when tried to render TextInput on RN 0.64.x and using appcompat library of 1.4.0

See original GitHub issue

Description

Latest 0.64 react-native is not compatible with latest appcompat androidx library. When app tries to render TextInput, NullPointerException thrown. This happens in file ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java (line 972):

private void updateCachedSpannable(boolean resetStyles) { // Noops in non-Fabric if (!mFabricViewStateManager.hasStateWrapper()) { return; }

This happens because super constructor AppCompatEditText calls updateCachedSpannable as part of construction, so mFabricViewStateManager not initialized yet and is null. So need to check mFabricViewStateManager for null value first.

React Native version:

System: OS: macOS 10.15.7 CPU: (8) x64 Intel® Core™ i7-2600K CPU @ 3.40GHz Memory: 790.90 MB / 24.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 15.4.0 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.0.15 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.10.1 - /Users/st1ng/.rvm/gems/ruby-2.7.0/bin/pod SDKs: iOS SDK: Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2 Android SDK: API Levels: 23, 25, 26, 27, 28, 29, 30 Build Tools: 25.0.0, 26.0.0, 27.0.3, 28.0.3, 29.0.2, 29.0.3, 30.0.0, 30.0.2 System Images: android-21 | Google APIs Intel x86 Atom_64, android-24 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google Play Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: 4.2 AI-202.7660.26.42.7322048 Xcode: 12.4/12D4e - /usr/bin/xcodebuild Languages: Java: 1.8.0_221 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.1 => 17.0.1 react-native: 0.64.1 => 0.64.1

Steps To Reproduce

  1. Create empty project
  2. Set explicitly appcompat version to 1.4.0-alpha01 or make it “+” in app/build.gradle implementation "androidx.appcompat:appcompat:1.4.0-alpha01"
  3. Add empty TextInput to any page

Expected Results

No crash happen

Snack, code example, screenshot, or link to a repository:

Screenshot_1621715066

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:15
  • Comments:23 (4 by maintainers)

github_iconTop GitHub Comments

47reactions
cristianoccazinspcommented, Sep 2, 2021

Use this for now:

implementation ("androidx.appcompat:appcompat:1.3.1") {
        version {
            strictly '1.3.1'
        }
    }
3reactions
BANG88commented, Jan 6, 2022

Use this for now:

implementation ("androidx.appcompat:appcompat:1.3.1") {
        version {
            strictly '1.3.1'
        }
    }

Save my day!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Crashes When It Tries to Render TextInput - PSPDFKit
React Native 0.64 isn't compatible with the latest version of Appcompat, ... When an app tries to render TextInput , a NullPointerException is...
Read more >
Getting error while running `react-native run-android`
As some has mentioned, the problem is that the RN build automatically "upgraded" to androidx.core:core:1.7.0-alpha01, which depends on SDK ...
Read more >
App compat 1.4.0 randomly crash with TextView and char ...
Strangely the crash have no reference to appcompat stuff, but it's the update to 1.4.0 that cause this. Since I have no idea...
Read more >
react-native-maps | Yarn - Package Manager
React Native Mapview component for iOS + Android ... by a small group of people, and any help with issues and pull requests...
Read more >
react native reanimated build error - You.com | The search engine ...
They probably haven't not upgraded Android to RN 0.65 yet. See similar issue that happened for early upgraders to RN 0.64-rc.1 who used...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found