How to integrate Admob interstitial ads using​ AIDE?

AIDE can be used to integrate Admob Ads to a Sketchware project. Follow the steps below to integrate Admob interstitial ads to a sketchware project using AIDE.

  • An Android project (Sketchware project)
  • AIDE with pro account key purchased
  • Account in Google developer console
  • Account in Admob
Before placing admob ads in an app, the app needs to be uploaded to google play store, however test ads can be tried in any app.

Always place the test ad ID before placing your ad unit ID. App ID and ad unit ID can be obtained by registering the app on Admob. But for using test ads no registration is required.

Do not click on your own Ads.

Export the Sketchware project

In Sketchware, under MY PROJECTS, go to project settings of the app to be exported, and click on Export to PC (Android Studio).
The exported file is a zip file. Create a new folder and decompress the contents of the zip file in it.

Check whether the res folder at location app/src/main/res contains only layout folder with all xml files or it contains all other folders like drawable, drawable-xhdpi, raw, values, values-v21. If all these folders are present then move to the next step of editing AndroidManifest.xml.

Edit the AndroidManifest.xml file

Open AIDE, browse to the AndroidManifest.xml file of the exported project and open it.

Change version code and version name as per your project.
After that add the following permissions:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

In application element add your APP ID by adding following meta-data:
android:name = ""
android:value = "ca-app-pub-3940256099942544~3347511713"/>

Important: This step is required as of Google Mobile Ads SDK version 17.0.0. Failure to add this <meta-data> tag results in a crash with the message: "The Google Mobile Ads SDK was initialized incorrectly."

Also add the following activity:
<activity android:name=""
android:theme="@android:style/Theme.Translucent" />

Save the file after editing.

Edit file

Add the following code in imports:

After the code 'public class MainActivity extends Activity {' add the following code:
private InterstitialAd mInterstitialAd;

After that create and load ad by adding following code after line 'setContentView(R.layout.activity_main);' in onCreate event:
mInterstitialAd = new InterstitialAd(this);
mInterstitialAd.loadAd(new AdRequest.Builder().build());

After testing with test ads replace the adUnitId with your own adUnitId.

Then after the code to create and load ad, add code for adListener just below it:

mInterstitialAd.setAdListener(new AdListener() {
public void onAdLoaded() {
// Code to be executed when an ad finishes loading.
Log.i("Ads", "onAdLoaded");

public void onAdFailedToLoad(int errorCode) {
// Code to be executed when an ad request fails.
Log.i("Ads", "onAdFailedToLoad");

public void onAdOpened() {
// Code to be executed when the ad is displayed.
Log.i("Ads", "onAdOpened");

public void onAdLeftApplication() {
// Code to be executed when the user has left the app.
Log.i("Ads", "onAdLeftApplication");

public void onAdClosed() {
// Code to be executed when when the interstitial ad is closed.
Log.i("Ads", "onAdClosed");
mInterstitialAd.loadAd(new AdRequest.Builder().build());

Add code to show the ad

The code to display interstitial ads has to be added to the event or activity when the ad is intended to be displayed. The code for displaying ads is:
if (mInterstitialAd.isLoaded()) {
        } else {
           Log.d("TAG", "The interstitial wasn't loaded yet.");


If you want to display ads on page start then it should look like this:

public void onStart() {
if (mInterstitialAd.isLoaded()) {
        } else {
            Log.d("TAG", "The interstitial wasn't loaded yet.");

Changes to build.gradle file

Navigate to app level build.gradle and Add following to project:

Also, in build.gradle file change version code and version name to same as in AndroidManifest.xml.
Save the file.

After this if you find no errors, then run the project. If you find the error 'R cannot be resolved', then go to AndroidManifest.xml and make any small change like removing a space and then save the file again. If you find any other error, try to resolve as per the error message.

Watch the video below to understand better:

This post is only regarding integration of Admob interstitial ads. The App ID and Ad unit ID used here are those for test ads and can be used in any android project. The ad unit ID for interstitial ads and banner ads are different.


  1. I tried with different debt cards for payment(Professional account),but everytime it shows error.My cards are working perfectly at other merchant sites!Any guidance!!

    1. Are you talking about AIDE or Google developer console?


  2. For Google developer console you need credit card.

    AIDE subscription can be bought using any card or internet banking.

    1. Please help me I have SBi card how open Google console Account use Sbi

  3. Hi , I use Aide 3.2.2 but in build.gradle , i can't find ( add to progect)
    witch version You use ?

  4. This comment has been removed by the author.

  5. Thank you very much brother, you always save the situation
    Continue to offer the best

  6. Since you guys were having problems loading the ads, I decided to help.
    Download APK Editor Pro

    1. Go to settings in APK Editor Pro.

    2. Sign the APK with key created by APK Editor.

    3. Go back and click Select APK From App.

    4. Then select an app.

    5. Set the language as [Default].

    6. Click build. You might need to uninstall the app and install it again.

    Happy implementing! :)


Post a Comment

Popular posts from this blog

Simple car racing android game in Sketchware

Creating a Drawing View in Sketchware

Enable Fullscreen for Youtube videos in WebView

How to enable upload from webview in Sketchware?

List of Calendar Format symbols valid in Sketchware