Solved

Amplitude Logger Error

  • 15 November 2022
  • 4 replies
  • 74 views

Hello !
I use React Native SDK and library "@amplitude/analytics-react-native": "0.5.1", and it’s work fine for IOS, but have some problem with Android. When I try some event I have error like on screenshot

 await ampli.load({
environment: 'production',
client: {
apiKey: apiKey,
},
})




<Button onPress={() => ampli.login()} title='Login' />

This code - how I initialize amplitude and call inside component .
Could you please help me to find what might be wrong?

icon

Best answer by eddie.gaona 17 November 2022, 21:50

View original

4 replies

Userlevel 5
Badge +8

@Gaka Happy to help!

Are you using the React Native SDK Beta, here? I can see that you are using Ampli to initialize the SDK, however, if you are using React Native Beta Ampli is not yet supported as mentioned in the documentation, here.

In order to use Ampli with React you will need to use the legacy version of the SDK, here.

Hello @eddie.gaona!

Yes, you are right, thanks a lot! The error disappear, but events from Android device still does not come to Amplitude service. Apparently this error was not the reason for not delivering events from android.

Maybe something another thing is not supported too? What might be a reason? Now I use React Native SDK legacy and library "@amplitude/react-native": "2.16.2"

Userlevel 5
Badge +8

Hello @Gaka sounds like you are no longer seeing the error but events are not being ingested for Android devices. 

I see that you have added a source “react_native_sdk_legacy” but when I look at the tracking plan none of the events have this source. Can you add this source to your events and try again?

For example, your login event does not have any sources and in order to use Ampli you need to add sources to your events.

 

Hello @eddie.gaona ! Thank you for your answer! Yes, I added react_native_sdk_legacy for some events, and try it. From IOS emulator everything is fine, all events with this source I can see in Amplitude User Look-Up. But when I try the same from Android device - nothing happens. 
Now, with React Native SDK legacy I initialise amplitude like this code below:


function initAmplitude() {
const ampInstance = Amplitude.getInstance();
return ampInstance.init(api_key);
}
<Button onPress={() => ampli.loginEnablePasswordMode()}>

Maybe something else needs to be enabled? Maybe some Amplitude property's or settings ?

Reply