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 FlatUIImplementation: Attempt to invoke virtual method PipelineDraweeControllerBuilderSupplier.get()' on a null object reference

See original GitHub issue

Is this a bug report?

Yes

Have you read the Bugs section of the Contributing to React Native Guide?

Yes

Environment

  1. react-native -v: react-native: 0.46.0-rc.2
  2. node -v: v7.4.0
  3. npm -v: 4.0.5
  4. yarn --version (if you use Yarn): 0.24.5

Then, specify:

  1. Target Platform (e.g. iOS, Android): Android
  2. Development Operating System (e.g. macOS Sierra, Windows 10): macOS Sierra
  3. Build tools (Xcode or Android Studio version, iOS or Android SDK version, if relevant):
  • Android SDK Tools 25.2.2
  • Tested on Samsung 8 device via USB debugging

Steps to Reproduce

Either

  1. git clone https://github.com/jevakallio/FlatUIImplementationBugRepro.git
  2. yarn
  3. react-native run-android (with device or emulator connected)

Or, manually:

  1. react-native init BleedingEdge --version react-native@0.46.0-rc.2
  2. rm .babelrc to work around facebook/react-native#14530
  3. Use FlatUIImplementationProvider (diff)
  4. react-native run-android

Expected Behavior

Renders the empty react-native init template project.

Actual Behavior

I get the following redbox error (screenshot below):

Attempt to invoke virtual method 'com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilderSupplier.get()' on a null object reference.
  • When redbox is dismissed, no content is rendered on the screen.
  • When the app is started directly from react-native run-android, the error only occurs occasionally
  • When the app is closed and restarted directly on device, the error occurs every time.
  • Note that there are no Image elements in the repro app, so Fresco error is surprising

screenshot_20170630-140542

The last stack trace on the React Native side is at https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/flat/RCTImageViewManager.java#L52

Reproducible Demo

https://github.com/jevakallio/FlatUIImplementationBugRepro

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
aahzcommented, Jul 14, 2017

Finally found a solution to solve the problem for me. It seems like it is somewhere here at FlatUIImplementation.java and likely described in a comment.

But the solution is to init Fresco before this method execution. So, I’ve added Fresco.initialize(this); right after super.onCreate(); call at MainApplication.java and now the appearance seems to be fixed. Not sure the solution is good and may be someone may offer better, but it’s worked. Possibly related to https://github.com/facebook/fresco/issues/1679 issue.

Example

public class MainApplication extends Application implements ReactApplication {
  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    @Override
    public boolean getUseDeveloperSupport() {
      return BuildConfig.DEBUG;
    }

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage()
      );
    }

    @Override
    protected UIImplementationProvider getUIImplementationProvider() {
      return new FlatUIImplementationProvider();
    }
  };

  @Override
  public ReactNativeHost getReactNativeHost() {
    return mReactNativeHost;
  }

  @Override
  public void onCreate() {
    super.onCreate();
    Fresco.initialize(this); // <<< This line
    SoLoader.init(this, /* native exopackage */ false);
  }
}

Hope this will help

0reactions
hramoscommented, Sep 21, 2017

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we’re automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android Attempt to invoke virtual method '...' on a null object ...
That seems like response.body().getQuery().getResults() returns null , and then you try invoke getChannel() on null.
Read more >
Error "Attempt to invoke virtual method 'int andro...
I get the error "Attempt to invoke virtual method 'int android graphics.bimap.getwidth() on a null object reference". this is a pretty critical issue, ......
Read more >
java.lang.NullPointerException: Attempt to invoke virtual ...
Hello team, I am facing this exception a lot of times. java.lang.NullPointerException: Attempt to invoke virtual method 'void ...
Read more >
Fixed Error android error attempt to invoke virtual method
Deal with textview gets error attempt to invoke virtual method 'void ... or attempt to invoke virtual method on a null object reference...
Read more >
Attempt to Invoke Virtual Method androidx.appcompat.app ...
Attempt to Invoke Virtual Method androidx.appcompat.app.ActionBar.hide() on a Null Object ReferenceHello Guys Welcome back, So in this video ...
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