The Sdk Has Not Been Initialized, Make Sure To Call Facebooksdk.sdkinitialize() First
Solution 1:
The docs have you set it in the Application class now:
publicclassMyApplicationextendsApplication {
@OverridepublicvoidonCreate() {
super.onCreate();
// Initialize the SDK before executing any other operations,
FacebookSdk.sdkInitialize(getApplicationContext());
AppEventsLogger.activateApp(this);
}
}
https://developers.facebook.com/docs/android/getting-started/
Solution 2:
First of all you need to use maveen() and both dependencies(here you forget to add annotation dependencies) of Facebook Audience Network, After this you your all problem will be solved.
Do not implement helper class , it is deprecated.
In Android Studio, make sure that mavenCentral() or jcenter() is included in your project's list of repositories. Repositories are defined in your project's module-level build.gradle file.
repositories {
mavenCentral()
jcenter()
}
Next, add the following implementation dependencies (check latest sdk- https://developers.facebook.com/docs/audience-network/guides/adding-sdk/android ) to your project's list of dependencies. Dependencies are also defined in your project's module-level build.gradle file. Note that annotation support is required by the Audience Network SDK.
dependencies {
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.facebook.android:audience-network-sdk:5.+'
}
After at all do not implement helper classs. Replace it to latest method, call AudienceNetworkAds.initialize(this)
in onCreate
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AudienceNetworkAds.initialize(this);
}
Thanks Happy Coding :)
Post a Comment for "The Sdk Has Not Been Initialized, Make Sure To Call Facebooksdk.sdkinitialize() First"