title: How to fix "TypeError: undefined is not an object (evaluating '_reactNativeCamera.default.constants')" error in react native?
body: <p>I'm trying to use "React-native-camera" library in my project. I've literally done this over 50 times and everything went fine each time both on my mac and Linux System.</p>
  
  <p>But now out of a sudden it wont work on my Linux System anymore and keeps generating this error (works on mac though!).</p>
  
  <p><img src="https://i.stack.imgur.com/11M5V.png" alt="enter image description here"></p>
  
  <p>I've checked all the configuring steps <a href="https://github.com/react-native-community/react-native-camera" rel="noreferrer">here</a>
  I've tried adding missingDimensionStrategy 'react-native-camera', 'general' to app build.gradle
  I've tried adding maven {url "<a href="https://jitpack.io" rel="noreferrer">https://jitpack.io</a>"} and maven {url "<a href="https://maven.google.com" rel="noreferrer">https://maven.google.com</a>"} to project build.gradle
  I've tried removing madules.xml from .ideas directory and restarting android studio both with and without cache clearing.</p>
  
  <p>still nothing
  This was my sample code to get the camera module going:</p>
  
  <pre><code>class CameraApp extends Component {
    constructor(props) {
      super(props);
  
      this.state = {
        path: null,
        uri: '',
        imageName: ''
      };
    }
  
    takePicture() {
      this.camera.capture()
        .then((data) =&gt; {
          console.log(data);  
        })
        .catch(err =&gt; console.error(err));
  }
  
    renderCamera() {
      return (
        &lt;View&gt;
          &lt;Camera
            ref={(cam) =&gt; {
              this.camera = cam;
            }}
            style={styles.preview}
            aspect={Camera.constants.Aspect.fill}
            captureTarget={Camera.constants.CaptureTarget.disk}
          &gt;
            &lt;TouchableHighlight
              style={styles.capture}
              onPress={this.takePicture.bind(this)}
              underlayColor="rgba(255, 255, 255, 0.5)"
            &gt;
              &lt;View /&gt;
            &lt;/TouchableHighlight&gt;
          &lt;/Camera&gt;
        &lt;/View&gt;
      );
    }
  
  
    render() {
      return (
        &lt;View style={styles.container}&gt;
          {this.renderCamera()}
        &lt;/View&gt;
      );
    }
  };
  </code></pre>