I need to configure the mixpanel in my work and for that I created a test project to understand how to configure the mixpanel SDK.
I followed the basic examples in the documentation. https://github.com/davodesign84/react-native-mixpanel
But I'm having a problem: 'null is not an object (evaluating RNMixpnael.sharedInstanceWithToken)'.
this is my code:
import React from 'react';
import {
SafeAreaView,
Text,
StatusBar,
} from 'react-native';
import Mixpanel from 'react-native-mixpanel';
Mixpanel.sharedInstanceWithToken("MY_PROJECT_TOKEN");
const App: () => React$Node = () => {
return (
<>
<StatusBar barStyle="dark-content" />
<SafeAreaView>
<Text>Testing Mixpanel SDK</Text>
</SafeAreaView>
</>
);
};
export default App;
And the error:
Could someone help me understand what I'm doing wrong?
What worked for me was adding this line to
MainApplication.java