Using admob ads in processing

@boldi999 ===

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

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

<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>

@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)

here is the sketch folder

and the code folder:

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

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

@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+…

1 Like

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:

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
----------

@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.

@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

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?

@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!

@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…

@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…

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.

@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…

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?

@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…