Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

  • The com.google.android cannot be resolved

    @DottorTurbo This post can go back and forth for a long time if you don't provide the proper information. I believe there was a really big effort put forward by akenaton explaining how to setup admob in a processing sketch. However, here he is repeating himself. You need to put some effort and go through the suggestions in that reference post.

    Your problem is not processing itself but it is your code using proper lib calls and the proper setup of the libraries. Also you need to become familiar with MCVE as this will provide a way to reproduce the problem, if any. It also shows your effort and your approach and you will get more relevant feedback. If something doesn't work or fails, please provide details. Don't just say the problem persist. What persist? What problem? Instead, add a detail explanation of your observation and, if you get an error message, please a verbatin output of this message in your post.

    Kf

  • What are the exact steps to add AdMob to my app?

    @akenaton===

    I opened tools/bin with powershell and used '.\sdkmanager --list' and I can confirm that I did NOT have Google Play Services installed. I then installed it using powershell and now I have these packages installed:

    Installed packages:=====================] 100% Computing updates...
      Path                               | Version | Description                        | Location
      -------                            | ------- | -------                            | -------
      build-tools;26.0.3                 | 26.0.3  | Android SDK Build-Tools 26.0.3     | build-tools\26.0.3\
      extras;android;m2repository        | 47.0.0  | Android Support Repository, rev 47 | extras\android\m2repository\
      extras;google;google_play_services | 46      | Google Play services               | extras\google\google_play_services\
      extras;google;m2repository         | 58.0.0  | Google Repository, rev 58          | extras\google\m2repository\
      extras;google;usb_driver           | 11.0.0  | google usb_driver, rev 11          | extras\google\usb_driver\
      patcher;v4                         | 1       | SDK Patch Applier v4               | patcher\v4\
      platform-tools                     | 27.0.0  | Android SDK Platform-Tools 27      | platform-tools\
      platforms;android-26               | 2       | Android SDK Platform 26, rev 2     | platforms\android-26\
      tools                              | 26.1.1  | Android SDK Tools 26.1.1           | tools\
    

    However AdMob STILL DOES NOT WORK.

    I tried a few different gms versions in the manifest with no success. The imports are still not recognized. Do I need to install another package?

  • What are the exact steps to add AdMob to my app?

    Can anyone recommend an SDK that has a clear gms version and works with AdMob?

  • What are the exact steps to add AdMob to my app?

    @akenaton ===

    For some reason after reinstalling processing it stopped recognizing the com.google imports no matter what I do. This is my manifest:

    <?xml version="1.0" encoding="UTF-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package=""> <uses-sdk android:minSdkVersion="17" android:targetSdkVersion="26"/> <application android:icon="@drawable/icon" android:label=""> <activity android:name=".MainActivity" android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:configChanges="keyboard|keyboardHidden|orientation" android:name="com.google.ads.AdActivity"/> <meta-data android:name="com.google.android.gms.version" android:value="ca-app-pub-3940256099942544/6300978111"/> </application> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.READ_PHONE_STATE"/> <uses-permission android:name="android.permission.SET_ORIENTATION"/> </manifest>

    I got the ca-app-pub for testing from the admob site.

    Maybe it's a problem with the .jar file. The .zip that you have sent a link to in the other topic has a LOT of files in it -- which one exactly do I need to put in my code folder? I'm confused

  • What are the exact steps to add AdMob to my app?

    @akenaton

    I don't just know nothing about Android - I basically know nothing about coding altogether.

    I started merely a month ago. But I am a quick learner and have gotten pretty far already, relying (and owing) only to experienced programmers like you who are willing to help.

    I don't know what I can do to show my gratitude for your help. It is in my nature to want to know more, so I will probably keep asking rather complicated things. If you think I know too little to achieve the things I want to achieve, you don't have to bother to answer. However, so far I have been able to grasp everything I ask about if somebody provides a good description.

    AdMob is clear to me now and has been successfully implemented in my code.

    THANKS A LOT FOR EVERYONE'S HELP!

  • What are the exact steps to add AdMob to my app?

    @randomdude===

    • first step: get your Ad unit id from your admob account; it should be something like ca-app-pub-(+ a lot of numbers); if only for testing use the ad unit id given by Google: ca-app-pub-3940256099942544~3347511713; then choose a format among the 3 provided: as for now choose "banner" which is the more simple.

    • second step: use the code i have already given and that i give again:

                  import android.os.Looper;//for setup() if needed
                  import android.os.Bundle;
                  import android.view.Window;
                  import android.widget.RelativeLayout;
                  import android.app.Activity;
                //  import com.google.ads.*;//
                  import com.google.android.gms.ads.AdRequest;
                  import com.google.android.gms.ads.AdView;
                  import com.google.android.gms.ads.AdSize;
                  import com.google.android.gms.ads.MobileAds;
      
      
                  public void setup(){
                    size(800, 1000);
                   }
      
                  public void draw(){
                     background(0);
                  }
      
                  @ Override
                  public void onCreate(Bundle savedInstanceState) {
                     super.onCreate(savedInstanceState);
                  //here you get the window
                  Window window = getActivity().getWindow();
                  //here you add a layout to your window; working with AS or Eclipse you can skip that because you can modify the xml; with processing you have to do that by code
                   RelativeLayout adsLayout = new RelativeLayout(this.getActivity());
                  //here you set the params for your layout
                   RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(
                      RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.MATCH_PARENT);
      
                  // now you create your View
      
                  AdView adView = new AdView(this.getActivity());
      
                  adView.setAdSize(AdSize.BANNER);
      
                  adView.setAdUnitId("ca-app-pub-xxxxxxxxxxxxxxxxxxxxxx");
      
                  // here you add the view to the layout and build your AdRequest
                    adsLayout.addView(adView);
                      AdRequest newAdReq = new AdRequest.Builder()
      
            // .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)//
             //  .addTestDevice("xxxxxxxxxxxxxxxxx")// this is the id  from your phone for testing; you can get it using TelephonyManager
      
                      .build();
      
                      adView.loadAd(newAdReq);
      
                  ///and finally ad the whole stuff to your window
                      window.addContentView(adsLayout,lp2);
      
      
                  };
      
    • step 3: modify your Manifest a) adding permissions:::

                   <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
                    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
                    <uses-permission android:name="android.permission.INTERNET"/>
                    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
                    <uses-permission android:name="android.permission.SET_ORIENTATION"/>
      
      
      
                                            b) adding metadata for your com.google.android.gms.version: this is the number corresponding to the version you want the client-user have : of course if it is not installed or if it s too old your app will not run; here you can write with some lines a method for checking the client phone and open a dialog asking for updating or installing;
      

    all these details are explained in the link you posted in this forum and you can find an example i have given for the Manifest;

    • step 4: verify that googlePlayServices is installed in your SDK (SDK menu, Extras)

    • step 5: try and see wether the imports can be solved; if not (that was the case in the discussion you have seen) get the .jar from the url i have given in the same discussion, create a folder "code" in your sketch and add the .jar. When you download it it is a .zip and its name contains the version number you have to write in your Manifest.

  • What are the exact steps to add AdMob to my app?

    https://developers.google.com/admob/android/quick-start

    This is the default AdMob guide that I have gone through but also don't understand as it's made for Android Developer Studio.

  • What are the exact steps to add AdMob to my app?

    Hello all!

    I am new to coding, been only doing it daily for a month or two, and I just finished my first game for android. I would like to add it to the Google Play Store with AdMob. I have registered for AdMob, and now I need to incorporate the ads to my code, however, I have no idea how to do that.

    I already saw https://forum.processing.org/two/discussion/16686/how-to-add-admob and I read through all of it twice, but am still completely at a loss. The topic is really messy and riddled with trials and errors, and has code and symbols that I have never used nor understood at all, making its contents practically unreadable for someone with as little coding experience as me. What is a manifest? What's a .jar file, why do I need it and where do I get it?

    I put so much effort into my game and I am so eager to see it in the store, but I just can't get past this final step.

    If some kind soul could give me and, likely, the thousands of other newcomers looking for an answer, a step-by-step walkthrough of exactly what I need to download, where I need to download it, and provide an organized snippet of code that I can adapt for my program, words can't describe how grateful I would be.

    Thank you all in advance!

  • Implementing ads with AdMob

    @akenaton I got the it 'working' with some code from this post but now when I run it on my android phone it crashes I suspect it has something to do with my manifest file so here's that

        <?xml version="1.0" encoding="UTF-8"?>
        <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="">
            <uses-sdk android:minSdkVersion="17" android:targetSdkVersion="26"/>
            <application android:icon="@drawable/icon" android:label="">
                <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
                <activity android:name=".MainActivity" android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen">
                    <intent-filter>
                        <action android:name="android.intent.action.MAIN"/>
                        <category android:name="android.intent.category.LAUNCHER"/>
                    </intent-filter>
                </activity>
                <activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:name="com.google.ads.AdActivity"/>
            </application>
            <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
            <uses-permission android:name="android.permission.INTERNET"/>
        </manifest>
    

    Here's the actual code

        import android.os.Looper;//for setup() if needed
        import android.os.Bundle;
        import android.view.Window;
        import android.widget.RelativeLayout;
        import android.app.Activity;
        import com.google.ads.*;
        import com.google.android.gms.ads.AdRequest;
        import com.google.android.gms.ads.AdView;
        import com.google.android.gms.ads.AdSize;
    
        public void setup(){
          size(900,600);
         }
    
        public void draw(){
    
        }
    
        @ Override
        public void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
        Window window = getActivity().getWindow();
         RelativeLayout adsLayout = new RelativeLayout(this.getActivity());
         RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.MATCH_PARENT);//Fill is deprecated
    
        AdView adView = new AdView(this.getActivity());
        adView.setAdSize(AdSize.BANNER);
        adView.setAdUnitId("ca-app-pub-3940256099942544");
          adsLayout.addView(adView);
            AdRequest newAdReq = new AdRequest.Builder()
            .build();
            adView.loadAd(newAdReq);
            window.addContentView(adsLayout,lp2);
        };
    

    and last but not least here's the error

    org.gradle.tooling.BuildException: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-4.0-bin.zip'.

    I think this is the most vital part of the error and it is insanely long, I could post it here if necessary. I changed everything as you requested and I added the metadata since processing recommended doing that so what's wrong?

  • Your own digital assistant like Siri

    If you are doing an art project or a demo then there might be ways to lightly interface with an existing speech-to-text engine -- like a Google or Mac cloud API or OS built-in.

    However, given that your previous question was about AdMob, I'm guessing that you want to interface a mobile Processing app with speech recognition for the purposes of a commercial application? Perhaps on Android using the Android Speech API...? We really need a lot more detail to understand your question.

  • Is there anyone who has successfully implemented AdMob?

    Use test Banner ID: ca-app-pub-3940256099942544/6300978111
    Interstitial ca-app-pub-3940256099942544/1033173712
    Rewarded Video ca-app-pub-3940256099942544/5224354917
    View details

  • Is there anyone who has successfully implemented AdMob?

    Is there anyone who has successfully implemented AdMob?

  • Implementing ads with AdMob

    So I recently uploaded my app to the play store and i wanted to implement ads, so I looked up this tutorial and It said I needed the AdMob library, so I went looking for it on the AdMob sites where they say I can get it with the google play service SDK which is great since I can download it with processing

    I use the code that is used in the forum post which is this one:

    import android.os.Bundle;
    import android.view.Gravity;
    import android.view.Window;
    import android.widget.RelativeLayout;
    import com.google.ads.*;
    
    @ Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Window window = getWindow();
        RelativeLayout adsLayout = new RelativeLayout(this);
        RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.FILL_PARENT);
        // Displays Ads at the bottom of your sketch, use Gravity.TOP to display them at the top
        adsLayout.setGravity(Gravity.BOTTOM);
        AdView adView = new AdView(this, AdSize.BANNER, "your-publisher-id");  // add your app-id
        adsLayout.addView(adView);
        AdRequest newAdReq = new AdRequest();
        // Remark: uncomment next line for testing your Ads (fake ads)
        //newAdReq.setTesting(true);
        adView.loadAd(newAdReq);
        window.addContentView(adsLayout,lp2);
    }
    

    but now the problem is that I got an error that says this: The import com.google cannot be resolved

    and the console says this:

    ----------
    1. WARNING in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\MainActivity.java (at line 9)
        import android.content.pm.PackageManager;
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    The import android.content.pm.PackageManager is never used
    ----------
    2. WARNING in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\MainActivity.java (at line 11)
        import android.support.v4.content.ContextCompat;
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    The import android.support.v4.content.ContextCompat is never used
    ----------
    3. WARNING in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\MainActivity.java (at line 13)
        import android.app.AlertDialog;
               ^^^^^^^^^^^^^^^^^^^^^^^
    The import android.app.AlertDialog is never used
    ----------
    4. WARNING in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\MainActivity.java (at line 14)
        import android.content.DialogInterface;
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    The import android.content.DialogInterface is never used
    ----------
    5. WARNING in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\MainActivity.java (at line 15)
        import android.Manifest;
               ^^^^^^^^^^^^^^^^
    The import android.Manifest is never used
    ----------
    6. WARNING in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\MainActivity.java (at line 49)
        int check;
            ^^^^^
    The value of the local variable check is not used
    ----------
    ----------
    7. ERROR in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\sketch_170817a.java (at line 13)
        import com.google.ads.*; 
               ^^^^^^^^^^
    The import com.google cannot be resolved
    ----------
    8. ERROR in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\sketch_170817a.java (at line 14)
        import com.google.android.gms.ads.AdRequest; 
               ^^^^^^^^^^
    The import com.google cannot be resolved
    ----------
    9. ERROR in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\sketch_170817a.java (at line 15)
        import com.google.android.gms.ads.AdView; 
               ^^^^^^^^^^
    The import com.google cannot be resolved
    ----------
    10. ERROR in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\sketch_170817a.java (at line 16)
        import com.google.android.gms.ads.AdSize; 
               ^^^^^^^^^^
    The import com.google cannot be resolved
    ----------
    11. ERROR in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\sketch_170817a.java (at line 17)
        import com.google.android.gms.ads.MobileAds; 
               ^^^^^^^^^^
    The import com.google cannot be resolved
    ----------
    12. ERROR in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\sketch_170817a.java (at line 60)
        AdView adView = new AdView(this.getActivity());
        ^^^^^^
    AdView cannot be resolved to a type
    ----------
    13. ERROR in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\sketch_170817a.java (at line 60)
        AdView adView = new AdView(this.getActivity());
                            ^^^^^^
    AdView cannot be resolved to a type
    ----------
    14. ERROR in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\sketch_170817a.java (at line 61)
        adView.setAdSize(AdSize.BANNER);
                         ^^^^^^
    AdSize cannot be resolved to a variable
    ----------
    15. ERROR in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\sketch_170817a.java (at line 64)
        AdRequest newAdReq = new AdRequest.Builder()
        ^^^^^^^^^
    AdRequest cannot be resolved to a type
    ----------
    16. ERROR in C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\src\processing\test\sketch_170817a\sketch_170817a.java (at line 64)
        AdRequest newAdReq = new AdRequest.Builder()
                                 ^^^^^^^^^
    AdRequest cannot be resolved to a type
    ----------
    16 problems (10 errors, 6 warnings)
    
    BUILD FAILED
    C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\build.xml:15: The following error occurred while executing this line:
    C:\Users\sjors\AppData\Local\Temp\android7328373206848409503sketch\build.xml:28: Compile failed; see the compiler error output for details.
    

    What did I do wrong I installed the google play service SDK through the default SDK manager.

  • How to replace advertisement for admob

    Please explore previos posts: https://forum.processing.org/two/search?Search=admob

    It is doable. people has done it in the past.

    Kf

  • Get an ERROR when select 'Run ond device' (android)

    Very few people has experience with admob or any advertisement in android (from what I have seen so far in the forum.... maybe there are just shy) You are better off if you share your code, or at least the more relevant parts of it. Please provide also any other relevant detail. It will be useful to know where did you get this code or at least, if you had it running before. I believe you also need an account to run this code, some sort of credentials after successfully registering to any of those services.

    Kf

  • How to replace advertisement for admob

    I succeeded to create my android app. But I can't monetize my app by advertisement. I choose adomb for monetization. So, how do I write the code? There is no information for processing admob.

  • How to add admob?

    Has problem solved? Have you add admob succesfully?