# Using admob ads in processing

**URL:** <https://discourse.processing.org/t/using-admob-ads-in-processing/7997>\
**Category:** Processing for Android\
**Created:** [January 31, 2019, 7:04pm UTC](https://discourse.processing.org/t/using-admob-ads-in-processing/7997 "2019-01-31T19:04:05Z")\
**Posts on this page:** 18\
**Page:** 2

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [February 21, 2019, 8:52am UTC](https://discourse.processing.org/t/using-admob-ads-in-processing/7997/21 "2019-02-21T08:52:47Z")

</div>

@boldi999 ===

- as for your imports they seem to be ok
- as for the value try this: 8115000 if the other one does not work

---

<div class="post-metadata">

**Author:** ![boldi999](https://avatars.discourse-cdn.com/v4/letter/b/ee7513/32.png) [@boldi999](https://discourse.processing.org/u/boldi999)\
**Post date:** [February 21, 2019, 9:57am UTC](https://discourse.processing.org/t/using-admob-ads-in-processing/7997/22 "2019-02-21T09:57:52Z")

</div>

I tried with 8115000 but it still doesn’t work. I got the “no library found for…” error message.  
Manifest looks like this now:

```auto
<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|screenLayout|uiMode|screenSize|smallestScreenSize" android:name="com.google.android.gms.ads.AdActivity"/>
<meta-data android:name="com.google.android.gms.version" android:value="8115000"/>
</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"/>
</manifest>

```

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [February 21, 2019, 1:59pm UTC](https://discourse.processing.org/t/using-admob-ads-in-processing/7997/23 "2019-02-21T13:59:48Z")

</div>

@boldi999 ==== stupid question… but: can you put some screen shot of your code folder with the jar inside it … I must see its name.  
(your manifest is ok)

---

<div class="post-metadata">

**Author:** ![boldi999](https://avatars.discourse-cdn.com/v4/letter/b/ee7513/32.png) [@boldi999](https://discourse.processing.org/u/boldi999)\
**Post date:** [February 21, 2019, 2:33pm UTC](https://discourse.processing.org/t/using-admob-ads-in-processing/7997/24 "2019-02-21T14:33:57Z")

</div>

here is the sketch folder

 ![Screenshot_2019-02-21-15-30-38-1](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/a/a69b019c5a74b992d64147df1dd0983c7bf48e6a.png) and the code folder: ![Screenshot_2019-02-21-15-30-54-1](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/4/49849e9ef6d2b6656c8ebf4de229f3df22023542.png)

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [February 21, 2019, 3:39pm UTC](https://discourse.processing.org/t/using-admob-ads-in-processing/7997/25 "2019-02-21T15:39:40Z")

</div>

@boldi999 ===  
ok, try to rename your jar only to “google-play-services.jar”

---

<div class="post-metadata">

**Author:** ![boldi999](https://avatars.discourse-cdn.com/v4/letter/b/ee7513/32.png) [@boldi999](https://discourse.processing.org/u/boldi999)\
**Post date:** [February 21, 2019, 3:43pm UTC](https://discourse.processing.org/t/using-admob-ads-in-processing/7997/26 "2019-02-21T15:43:18Z")

</div>

I tried: still “No library found for…” error

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [February 21, 2019, 6:02pm UTC](https://discourse.processing.org/t/using-admob-ads-in-processing/7997/27 "2019-02-21T18:02:47Z")

</div>

@boldi999 ===  
and it compiles??? (except this error - or do you get other errors?)  
Anyway i have to have a look to that; i begin to think that the workaround used (old jar) no more works with gradle 3+…

---

<div class="post-metadata">

**Author:** ![boldi999](https://avatars.discourse-cdn.com/v4/letter/b/ee7513/32.png) [@boldi999](https://discourse.processing.org/u/boldi999)\
**Post date:** [February 22, 2019, 9:08am UTC](https://discourse.processing.org/t/using-admob-ads-in-processing/7997/28 "2019-02-22T09:08:32Z")

</div>

No, it can’t compile beacuse it doesn’t finds the library for those 4 imports which I showed to you above.  
Do you have a working jar or a working simple exaple sketch?  
anyway here is are the errors:

```auto
No library found for com.google.android.gms.ads
No library found for com.google.android.gms.ads
No library found for com.google.android.gms.ads
No library found for com.google.android.gms.ads
Injected log broadcaster
mkdir failed: EEXIST (File exists) : /data/data/com.calsignlabs.apde/app_build/res
Detected architecture armeabi-v7a

Packaging resources with AAPT…
Compiling with ECJ…
----------
1. ERROR in /data/data/com.calsignlabs.apde/app_build/src/processing/test/ads/ads.java (at line 13)
	import com.google.android.gms.ads.AdRequest; 
	       ^^^^^^^^^^
The import com.google cannot be resolved
----------
2. ERROR in /data/data/com.calsignlabs.apde/app_build/src/processing/test/ads/ads.java (at line 14)
	import com.google.android.gms.ads.AdView; 
	       ^^^^^^^^^^
The import com.google cannot be resolved
----------
3. ERROR in /data/data/com.calsignlabs.apde/app_build/src/processing/test/ads/ads.java (at line 15)
	import com.google.android.gms.ads.AdSize; 
	       ^^^^^^^^^^
The import com.google cannot be resolved
----------
4. ERROR in /data/data/com.calsignlabs.apde/app_build/src/processing/test/ads/ads.java (at line 16)
	import com.google.android.gms.ads.MobileAds; 
	       ^^^^^^^^^^
The import com.google cannot be resolved
----------
5. ERROR in /data/data/com.calsignlabs.apde/app_build/src/processing/test/ads/ads.java (at line 62)
	AdView adView = new AdView(this.getActivity());
	^^^^^^
AdView cannot be resolved to a type
----------
6. ERROR in /data/data/com.calsignlabs.apde/app_build/src/processing/test/ads/ads.java (at line 62)
	AdView adView = new AdView(this.getActivity());
	                    ^^^^^^
AdView cannot be resolved to a type
----------
7. ERROR in /data/data/com.calsignlabs.apde/app_build/src/processing/test/ads/ads.java (at line 64)
	adView.setAdSize(AdSize.SMART_BANNER);
	                 ^^^^^^
AdSize cannot be resolved
----------
8. ERROR in /data/data/com.calsignlabs.apde/app_build/src/processing/test/ads/ads.java (at line 70)
	AdRequest newAdReq = new AdRequest.Builder()
	^^^^^^^^^
AdRequest cannot be resolved to a type
----------
9. ERROR in /data/data/com.calsignlabs.apde/app_build/src/processing/test/ads/ads.java (at line 70)
	AdRequest newAdReq = new AdRequest.Builder()
	                         ^^^^^^^^^
AdRequest cannot be resolved to a type
----------

```

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [February 22, 2019, 5:46pm UTC](https://discourse.processing.org/t/using-admob-ads-in-processing/7997/29 "2019-02-22T17:46:24Z")

</div>

@boldi999 === sorry, i never used APDE ; as for the jar i begin to think that the last P5 versions does not allow to use r27 or r28. I will verify that ASAP.

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [February 22, 2019, 5:49pm UTC](https://discourse.processing.org/t/using-admob-ads-in-processing/7997/30 "2019-02-22T17:49:32Z")

</div>

@boldi999 === tried with AS, same code (or adapted) and same jar added as dependency: everything works fine; tried again with P5: i dont get your errors but now another one which seems to be caused by gradle

---

<div class="post-metadata">

**Author:** ![boldi999](https://avatars.discourse-cdn.com/v4/letter/b/ee7513/32.png) [@boldi999](https://discourse.processing.org/u/boldi999)\
**Post date:** [February 23, 2019, 10:08pm UTC](https://discourse.processing.org/t/using-admob-ads-in-processing/7997/31 "2019-02-23T22:08:04Z")

</div>

Then is it possible to make it work with apde? If i try a new version (r29 for example) then will it work with apde? Or maybe I should change program. What is ASAP? I haven’t heard about it before.  
If it won’t work in APDE then can I easily make it work in P5?

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [February 24, 2019, 9:59am UTC](https://discourse.processing.org/t/using-admob-ads-in-processing/7997/32 "2019-02-24T09:59:45Z")

</div>

@boldi999 ===  
sorry: as i told you i never used APDE…As for trying with P5 android mode, yes, you can; in this case dont try to download r29, try with r27,which was the version i used ago: the problem is that if the errors for import disappear, other errors happen, with graddle ; another solution coul be to update the SDK (google-Play-services) to the last version, r43 or something like that and see if it is possible to find the necessary imports inside this package: it is probably possible but not easy: before r28 all was inside 1 .jar and now there are a lot of modules; that is what i have to verify ASAP: as soon as possible!

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [February 24, 2019, 2:41pm UTC](https://discourse.processing.org/t/using-admob-ads-in-processing/7997/33 "2019-02-24T14:41:21Z")

</div>

@boldi999 ===  
bad news; i have updated the google-play-service to r43 and seen that now there is absolutely nothing inside the package: that s done for AS and gradle and it works, but not for p5…

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [February 24, 2019, 7:14pm UTC](https://discourse.processing.org/t/using-admob-ads-in-processing/7997/34 "2019-02-24T19:14:36Z")

</div>

@boldi999 ===  
you can get aar files in the google mp2 repository and look inside this file: what you find is a library; is it possible to adapt it to P5??? - i dont know, i have to try…

---

<div class="post-metadata">

**Author:** ![boldi999](https://avatars.discourse-cdn.com/v4/letter/b/ee7513/32.png) [@boldi999](https://discourse.processing.org/u/boldi999)\
**Post date:** [February 27, 2019, 5:36pm UTC](https://discourse.processing.org/t/using-admob-ads-in-processing/7997/35 "2019-02-27T17:36:21Z")

</div>

Then if it’s works with ASAP is this possible: I make an app in APDE and when I finish the app, I put it into ASAP and in it I add the ads?  
Can you tell me what’s ASAP? I didn’t find anything about it.

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [February 27, 2019, 6:27pm UTC](https://discourse.processing.org/t/using-admob-ads-in-processing/7997/36 "2019-02-27T18:27:53Z")

</div>

@boldi ===  
dont worry about asap: it means only “as soon as possible”…  
i have already told that i know noting about APDE  
what i am sure is that you can do exactly the same thing with P5 android mode…

---

<div class="post-metadata">

**Author:** ![boldi999](https://avatars.discourse-cdn.com/v4/letter/b/ee7513/32.png) [@boldi999](https://discourse.processing.org/u/boldi999)\
**Post date:** [February 27, 2019, 6:42pm UTC](https://discourse.processing.org/t/using-admob-ads-in-processing/7997/37 "2019-02-27T18:42:24Z")

</div>

I’m so sorry I misunderstood, I thought that asap is something like p5 or apde…  
So is there any chance to make p5 work? If I understand there is no library in the new version of gplay services. Did you find any solution?

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [February 28, 2019, 12:14pm UTC](https://discourse.processing.org/t/using-admob-ads-in-processing/7997/38 "2019-02-28T12:14:25Z")

</div>

@boldi999 ===

- though i am sure that you can use adon easily with AS ( i have done that and it works) i think that the best is to try with P5 if you dont know android native coding.
- with P5 r27 works (import jar, as you have done) but gradle fires errors–
- into the mp2 repository inside your SDK you can find play-service .aar and inside it 4 jars; yet, if you unpack the .aar, what you find is a complete app with a manifest and res (which can be imported and added as a library for AS) and till now i cannot see how to use the jars with P5 because these jars are probably using res= here is the point where i am…and going further needs some time…

[Previous page](https://discourse.processing.org/t/using-admob-ads-in-processing/7997.md?page=1)
