GithubHelp home page GithubHelp logo

com.amplitude.api.AmplitudeClient: context cannot be null, set context with initialize() before calling logEvent() about amplitude-flutter HOT 7 CLOSED

amplitude avatar amplitude commented on June 14, 2024
com.amplitude.api.AmplitudeClient: context cannot be null, set context with initialize() before calling logEvent()

from amplitude-flutter.

Comments (7)

blaizechuang avatar blaizechuang commented on June 14, 2024 1

Sorry, it's my fault.
After calling init() in new plugin version, it works.

from amplitude-flutter.

rahi0 avatar rahi0 commented on June 14, 2024

Sorry, it's my fault.
After calling init() in new plugin version, it works.

I am having the same problem for my release apk. But debug app working correctly. Paypal button is not loading for release apk. While it's working for the dubg app

2021-04-15 11:28:38.392 7682-7780/com.example.flutterkotlinpypl E/com.amplitude.api.AmplitudeClient: context cannot be null, set context with initialize() before calling logEvent()
2021-04-15 11:28:38.396 7682-7780/com.example.flutterkotlinpypl E/nxoEvents: fire: No one listening to the event of type INSTRUMENTATION_SENT. 

from amplitude-flutter.

junyou131 avatar junyou131 commented on June 14, 2024

@blaizechuang Have you solved your problem?

from amplitude-flutter.

blaizechuang avatar blaizechuang commented on June 14, 2024

@junyou131 Yes, the root cause is I forgot to call the init() after creating the Amplitude object

from amplitude-flutter.

Gabriel-sys-hub avatar Gabriel-sys-hub commented on June 14, 2024

Im having the same issue, any1 else know to resolve this ?
E/com.amplitude.api.AmplitudeClient( 5900): context cannot be null, set context with initialize() before calling logEvent()

Im calling like this:

static Future initAmplitudeAnalytics() async {
final String amplitudeKey = dotenv.env["AMPLITUDE_KEY"]!;

final Amplitude analytics = Amplitude.getInstance(instanceName: "Project");


analytics.init(amplitudeKey, userId: 'teste');

Amplitude.getInstance().trackingSessionEvents(true);

}

from amplitude-flutter.

iqra-padela avatar iqra-padela commented on June 14, 2024

You need to provide the instance name when logging events.

analytics.trackingSessionEvents(true);
analytics.logEvent('my event' );

OR

 Amplitude.getInstance(instanceName: "Project").logEvent( 'my event');

from amplitude-flutter.

chhs2131 avatar chhs2131 commented on June 14, 2024

You need to provide the instance name when logging events.

analytics.trackingSessionEvents(true);
analytics.logEvent('my event' );

OR

 Amplitude.getInstance(instanceName: "Project").logEvent( 'my event');

great! It works for me!

final Identify identify = Identify()
  ..set('gender', 'female')
  ..set('age',20);
Amplitude.getInstance(instanceName: name).identify(identify);
image

from amplitude-flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.