Hi MIT App Inventor Community,
I'm currently working on developing an extension for Admob ads, but I've run into a runtime error that I can't seem to resolve.
Error Message:
Runtime Error
Failed resolution of: Lcom/google/android/gms/ads/internal/client/zzk:
Library Used:
I've double-checked my code and the libraries I'm using, but I'm still not sure why this error is occurring. Has anyone encountered a similar issue or could provide some guidance on how to fix it?
Basic Code I Used to Check the Initialization:
package com.simple.admob;
import android.app.Activity;
import android.content.Context;
import androidx.annotation.*;
import org.jetbrains.annotations.NotNull;
import com.google.android.gms.ads.*;
import com.google.android.gms.ads.RequestConfiguration;
import com.google.android.gms.ads.initialization.InitializationStatus;
import com.google.android.gms.ads.initialization.OnInitializationCompleteListener;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleEvent;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.EventDispatcher;
public class Admob extends AndroidNonvisibleComponent {
private Context context;
private Activity activity;
private boolean testMode = true;
public Admob(ComponentContainer container) {
super(container.$form());
this.context = container.$context();
this.activity = container.$context();
}
@SimpleFunction(description = "Initialize AdMob SDK.")
public void InitializeSdk() {
MobileAds.initialize(activity, new OnInitializationCompleteListener() {
@Override
public void onInitializationComplete(@NonNull InitializationStatus initializationStatus) {
SdkInitialized();
}
});
}
@SimpleEvent(description = "Event triggered when the AdMob SDK is successfully initialized.")
public void SdkInitialized() {
EventDispatcher.dispatchEvent(this, "SdkInitialized");
}
}
Any help would be greatly appreciated!
Thanks in advance.