Getting "invoke: no method named StartAdMob in class java.lang.Boolean" in Custom AdMob Extension

Hi, I'm building a custom AdMob extension for MIT App Inventor using Java.

I added a function like this:

@SimpleFunction(description = "Initialize AdMob SDK")
public void StartAdMob(final String appId) {
    if (appId == null || appId.trim().isEmpty()) {
        AdMobInitializationFailed("App ID cannot be null or empty");
        return;
    }

    final String finalAppId = appId.trim();

    if (activity != null) {
        activity.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                try {
                    if (!isInitialized) {
                        MobileAds.initialize(context, finalAppId);
                        isInitialized = true;
                        AdMobInitialized();
                    }
                } catch (Exception e) {
                    AdMobInitializationFailed(e.getMessage());
                }
            }
        });
    } else {
        AdMobInitializationFailed("Activity context is null");
    }
}

The method is properly annotated with @SimpleFunction, and it's inside my extension class. However, when I try to call it from the blocks, I get this error:

invoke: no method named 'StartAdMob' in class java.lang.Boolean

I’m not assigning the result to any variable or misusing any return values in blocks.

What could be causing this issue?

Thanks in advance.

When you get any error related to java.lang.Boolean, it is due to App Inventor not being able to instantiate the extension. When it fails, the lookup function returns false, which ends up being boxed as a Boolean. You should check the output of adb logcat for any stack traces related to your extension and debug the errors you find.

I found the error thanks

Where can I find play-services-ads-lite-15.0.0.jar?

I asked Gemini for you
Taifun


You can find play-services-ads-lite-15.0.0.jar in the Maven Central Repository, specifically at the Google repository.
Here's the direct link to its entry on MVNRepository:
https://mvnrepository.com/artifact/com.google.android.gms/play-services-ads-lite/15.0.0
On that page, you'll see options to download the .jar file directly.
It's worth noting that this is an older version. Google generally recommends using the latest version of the Google Mobile Ads SDK for Android, which is typically integrated through Gradle dependencies in your Android project (e.g., implementation 'com.google.android.gms:play-services-ads:+'). The "lite" SDK had specific use cases and a reduced release cadence. If you're starting a new project, you should almost certainly use the standard Google Mobile Ads SDK.

oh thanks am downloaded it with google colab