Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android FlatUIImplementation: Attempt to invoke virtual method PipelineDraweeControllerBuilderSupplier.get()' on a null object reference #14786

Closed
jevakallio opened this issue Jun 30, 2017 · 5 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@jevakallio
Copy link
Contributor

jevakallio commented Jun 30, 2017

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 [email protected]
  2. rm .babelrc to work around [0.46] Packager fails: Unknown plugin "transform-runtime" #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

@aahz
Copy link

aahz commented Jul 6, 2017

+1
Same error using FlatUIImplementation.

But the behaviour is really strange, sometimes it not occurs at all and after reload command usually disappears and everything is rendered as expected

@gerbenis
Copy link

gerbenis commented Jul 13, 2017

We're experiencing the same problem. It seems that a race condition occurs somewhere at the start of the app. The FlatUIImplementation is kind of critical to us, without it the overall app experience decreases significantly. Any updates on this issue?

@aahz
Copy link

aahz commented 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 facebook/fresco#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

@pj0579
Copy link

pj0579 commented Jul 19, 2017

@aahz it help me.

@hramos
Copy link
Contributor

hramos commented 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.

@hramos hramos added the Icebox label Sep 21, 2017
@hramos hramos closed this as completed Sep 21, 2017
@facebook facebook locked as resolved and limited conversation to collaborators Sep 21, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Sep 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

6 participants