Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: exception when calling the logEvent method #199

Closed
1 task done
agrawalharsh90 opened this issue Jan 17, 2022 · 13 comments
Closed
1 task done

[Bug]: exception when calling the logEvent method #199

agrawalharsh90 opened this issue Jan 17, 2022 · 13 comments
Labels
bug🐞 Something isn't working

Comments

@agrawalharsh90
Copy link

agrawalharsh90 commented Jan 17, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Flutter Facebook App Events gives the error: kotlin.UninitializedPropertyAccessException: lateinit property appEventsLogger has not been initialized

I am using the latest version of FaceBook App Events plugin in Flutter with the latest version of Flutter as well. On click event, I am calling the logEvent method like this:

facebookAppEvents.logEvent(
    name: 'Link Clicked',
    parameters: {'url': request.url},
);

where the facebookAppEvents defined and initialized in the class itself:

static final facebookAppEvents = FacebookAppEvents();

Expected Behavior

It should properly log the event the properly without any error.

Steps To Reproduce

No response

Platform

Android

Flutter Doctor

[✓] Flutter (Channel stable, 2.8.1, on macOS 12.0.1 21A559 darwin-arm, locale en-IN)
    • Flutter version 2.8.1 at /Users/harshagrawal/Documents/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 77d935af4d (5 weeks ago), 2021-12-16 08:37:33 -0800
    • Engine revision 890a5fca2e
    • Dart version 2.15.1

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/harshagrawal/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] VS Code (version 1.63.2)
    • VS Code at /Users/harshagrawal/Documents/development/Visual Studio Code.app/Contents
    • Flutter extension version 3.32.0

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 97.0.4692.71

• No issues found!
@agrawalharsh90 agrawalharsh90 added the bug🐞 Something isn't working label Jan 17, 2022
@agrawalharsh90
Copy link
Author

Screenshot 2022-01-19 at 11 08 24 AM

@agrawalharsh90
Copy link
Author

Screenshot 2022-01-19 at 11 11 13 AM

@agrawalharsh90
Copy link
Author

Screenshot 2022-01-19 at 11 11 27 AM

@agrawalharsh90
Copy link
Author

@anyone can help me in this issue as I have to solve this asap

@DennisAlund
Copy link
Member

I find 8 results when searching issues for "sdk initialized" please search, read and see if it is already discussed and solved

https://github.com/oddbit/flutter_facebook_app_events/search?q=sdk+initialized&type=issues

@agrawalharsh90
Copy link
Author

@DennisAlund no solution is in any of the issue,
There is one issue that has exact same problem but no solution is present in it.
#186

Can you please provide me the solution as to solve this?

@DennisAlund
Copy link
Member

Seems to be a configuration error by the user since the OP of #186 closed his own issue. I don't know what the solution was since he reported problem but closed it himself.

My assumption would be that he had misconfigured the setup. There was no explanation afterwards what he had missed. But if you find that you have a misconfiguration, I would really appreciate if you share with the community what it was and how you solved it.

But from my side, I can't reproduce it.

Have you tried comparing your project with the example project in the repo?

@AbdulrazakZakieh
Copy link

I am facing the same problem and I did all the configurations as instructed. setAdvertiserTracking is working but events are not.
I searched for similar problems but found none and all the issues you mentioned are irrelevant as I see it.

@agrawalharsh90
Copy link
Author

@AbdulrazakZakieh

not put id here manifest like this

        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="xxxxxxxxxx" />

add like this

        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id" />

create strings.xml file in android/app/src/main/res/values/ and put id here

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="facebook_app_id">xxxxxxxxxx</string>
</resources>

@furkanvatandas
Copy link

@AbdulrazakZakieh

not put id here manifest like this

        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="xxxxxxxxxx" />

add like this

        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id" />

create strings.xml file in android/app/src/main/res/values/ and put id here

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="facebook_app_id">xxxxxxxxxx</string>
</resources>

Not working for me

@furkanvatandas
Copy link

furkanvatandas commented May 9, 2022

https://developers.facebook.com/docs/app-events/getting-started-app-events-android

After adding <string name="facebook_client_token">YOUR_TOKEN</string> it's working

@mayder
Copy link

mayder commented May 10, 2022

@AbdulrazakZakieh
not put id here manifest like this

        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="xxxxxxxxxx" />

add like this

        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id" />

create strings.xml file in android/app/src/main/res/values/ and put id here

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="facebook_app_id">xxxxxxxxxx</string>
</resources>

Not working for me

I have the same problem.

@Ahmedklai
Copy link

So the solution was basically to put the :
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/> <meta-data android:name="com.facebook.sdk.ClientToken" android:value="@string/facebook_client_token"/>

in the right spot , they need to be under the application Tag , in the first range so not under appliction and then activity tag just under the application tag in the androidManifest just as in the pic below !
Screenshot 2022-07-10 at 11 58 44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug🐞 Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants