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.

I see the following error as soon as the camera opens in android’s adb: 10-22 19:53:02.178 2902-2922/com.floto E/Surface: getSlotFromBufferLocked: unknown buffer: 0xf40d3f80

I’ve tried with the latest version 22.10 i think, and I still see the same error and I see the emulator crashing. With 21.4 I still see the error, and I see camera crashes and it alerts “Can’t connect to the camera”, but at least the emulator doesn’t crash and neither does the app.

import React from 'react';
import {
  Linking,
  ListView,
  Platform,
  Text,
  TouchableHighlight,
  StyleSheet,
  View,
  RefreshControl,
  Image
} from 'react-native';

// Flux
import AltActions from '../../actions/actions';
import AltStore from '../../stores/store';

// React native screen router
import { Actions } from 'react-native-router-flux';

import {Icon, Container, Content, Card, CardItem, Thumbnail, Button } from 'native-base';

var ImagePicker = require('react-native-image-picker');

var ToolbarAndroid = require('ToolbarAndroid');
var toolbarActions = [];

export default class CreateFlow extends React.Component {
  constructor(props) {
    super(props);

    this.state = {}; 

  }

  componentDidMount() {
    AltStore.listen((state) => this.onAltStoreChange(state));
    this.takeImage(); 


  }

  componentWillUnmount() {
    AltStore.unlisten((state) => this.onAltStoreChange(state));

  }

  onAltStoreChange(state) {
    this.setState({
      target: state.target,
    });
  }

  renderContact() {
    var res; 
    if (!this.state.target)
    {
      userTxt = "Choose a person from your contacts to send a photo request";
    }
    else
    {
      userTxt = this.state.target["givenName"]; 
    }
    res = <Text> {userTxt} </Text>; 
    return res; 
  }

  takeImage() {

    const options = {
      title: 'Photo Picker',
      takePhotoButtonTitle: 'Take Photo...',
      chooseFromLibraryButtonTitle: 'Choose from Library...',
      maxWidth: 200,
      maxHeight: 220,
      aspectX: 2,
      aspectY: 1,
      storageOptions: {
        skipBackup: true
      }
    };

    ImagePicker.launchCamera(options, (response)  => {
      console.log('Response = ', response);

      if (response.didCancel) {
        console.log('User cancelled image taker');
        Actions.pop(); 
      }
      else if (response.error) {
        console.log('ImagePicker Error: ', response.error);
      }
      else if (response.customButton) {
        console.log('User tapped custom button: ', response.customButton);
      }

      else {
        var source;
        source = {uri: 'data:image/jpeg;base64,' + response.data, isStatic: true};

        this.setState({
          pic_source: source
        });
      }
    });

  }

  renderImage() {
    if (this.state.pic_source)
    {
      return <Image
          style={styles.image}
          source={this.state.pic_source} />; 
    }
  }


  render() {
    return (
      <View style={styles.container}>        
        {this.renderImage()}  
        {this.renderContact()}
        <Button onPress={Actions.ChooseContact}> Choose Contact </Button>
      </View>
    );
  }
}

var styles = StyleSheet.create({
  container: {
      flex: 1,
      justifyContent: "center",
      alignItems: "center",

  },

  toolbar: {
    flex: 1,
    backgroundColor: 'skyblue',
    justifyContent: 'center',
    alignItems: 'center',
  },
  image: {
      flex: 0,
      width: 200,
      height: 220
  },
  body: {
    flex: 10
  },
});```


Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
joshg111commented, Oct 25, 2016

It’s weird. When i create a new emulator with same configuration I see built-in camera app is working. If I use the built-in camera a number of times I can eventually make it crash the emulator. I posted an issue to android here. After emulator crashes, I relaunch and open the built-in camera app and it says “Can’t connect to the camera”. If I use android 7.1.1 emulator I don’t have any problems using the emulated camera. My emulator images are all newly downloaded from a couple days ago, and android studio as well. Everything is freshly installed.

0reactions
joshg111commented, Oct 25, 2016

I’m going to try my app on android nougat 7.1.1. I’m guessing there will not be any issue there. You know I had everything working on my windows station with android 6, but now I just switched everything to ubuntu 16.04 LTS.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Crashing (TV Series 2016) - IMDb
A comedy series following the lives of six 20- and 30-somethings living together as property guardians of a large, disused hospital.
Read more >
Crashing | Official Website for the HBO Series
Pete Holmes created and stars in this comedy series about a stand-up comic who learns that his wife is unfaithful, forcing him to...
Read more >
Crashing (British TV series) - Wikipedia
Crashing is a British comedy series produced by Big Talk Productions and written and created by Phoebe Waller-Bridge. Its six episodes aired from...
Read more >
Watch Crashing | Netflix Official Site
In exchange for low rent, a hodgepodge group of 20-something tenants set up residence as property guards in a disused hospital, where hilarity...
Read more >
Crashing - Rotten Tomatoes
Critics Consensus: Crashing's formula feels familiar despite its unusual setting, but Phoebe Waller-Bridges' buoyant performance and crackling script gives ...
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