Required AdMob update to 7.0.0

Monkey Targets Forums/Android/Required AdMob update to 7.0.0

therevills(Posted 2016) [#1]
I received the following email from Admob yesterday evening:

Hi,
AdMob is committed to providing you the most effective monetization solutions. As we innovate, it’s important that we leverage the latest technologies to bolster our platform. As part of this movement, we are deprecating versions 6.4.1 and lower of the Android Google Mobile Ads SDK on September 15th, 2016.
In order to ensure that your ads continue to serve after September 15th, 2016, please upgrade to Google Mobile Ads SDK 7.0.0 or higher.


I believe MonkeyX uses 6.4.1... what is the best way to update to 7.0.0?

Cheers,
Steve


Xaron(Posted 2016) [#2]
The best way is to replace the GoogleAdMobAdsSdk-6.4.1.jar file (pretty old version I see in my case) in MonkeyPro/modules/brl/native with the current one.
Then open the file admob.monkey under MonkeyPro/modules/brl and change

#LIBS+="${CD}/native/GoogleAdMobAdsSdk-6.4.1.jar"


to that new version.


pantson(Posted 2016) [#3]
From my understanding there is no jar file anymore in the SDK manager.
Can anyone else see a JAR file?


Xaron(Posted 2016) [#4]
You mean the Android SDK manager? No, it's not there, never been. It's in the monkey folder itself.


pantson(Posted 2016) [#5]
Apologies

The google Admob jar hasn't been available as a separate download for a longtime (I think). Its now incorporated as part of the google play services jar.
In the past month anything that i compile doesn't display ads. No errors in logs and no displays in the Admob manager either.
I thought about updating the JAR to the latest and it turns out that the Google Play Services JAR doesnt exist anymore, Im very confused on how to update monkey to use the latest version.

Maybe Ive updated some libs elsewhere, but I cannot get Ads displaying using brl.admob or bbd.gamesservicesadmob.
Does it work for anybody else lately?

in the meantime i will try to source a GoogleAdmobSDK 7.jar and try that


Xaron(Posted 2016) [#6]
Hmm I see. Now that's an issue. I guess Mark should step in?!


therevills(Posted 2016) [#7]
I have raised a "bug" report here:

http://www.monkey-x.com/Community/posts.php?topic=12351

I havent got time to look at this myself but there is a module somewhere which already links to the google play services for leader-board etc. And here is the official update guide from Google:

https://firebase.google.com/docs/admob/android/existing-app#where_to_place_banners


pantson(Posted 2016) [#8]
Hi Therevills
Thanks for raising the bug report.
Just to let you know that with no code update on my side, it seems that everything is working again now with brl.admob and bbd.gameservicesadmob
There may have been a bug at the Admob end and looks like it was with new ad units. I did find this post from the beginning of June https://groups.google.com/d/msg/google-admob-ads-sdk/I5IjGZzRp8M/9uKmAMgAAAAJ

The module you are referring to is bbd.gameservices by Ironstorm http://www.monkey-x.com/Community/posts.php?topic=8245&page=1 and it does work a treat. Many thanks Ironstorm!

Going forward though it'd be nice to know how to incorporate none jar plugins into Monkey.

ta!


therevills(Posted 2016) [#9]
Mark has released v87a which includes a fix for this... (I havent tested yet...)


Snader(Posted 2016) [#10]
Well, I needed up update my apps. So, back on monkey-x again ;)

I upgraded to v87a, but somehow none of my games are working anymore. Building fails... and I have no clue whats going wrong. Can someone give me a hint please?

-dex:
[dex] input: D:\Programming\Projects\Light Cycles Duel 2\super_light_cycles2.buildv87a\android_new\bin\classes
[dex] input: D:\Programming\Projects\Light Cycles Duel 2\super_light_cycles2.buildv87a\android_new\google-play-services_lib\bin\classes.jar
[dex] input: D:\Programming\Projects\Light Cycles Duel 2\super_light_cycles2.buildv87a\android_new\google-play-services_lib\libs\google-play-services.jar
[dex] Pre-Dexing D:\Programming\Projects\Light Cycles Duel 2\super_light_cycles2.buildv87a\android_new\google-play-services_lib\bin\classes.jar -> classes-cade0168e4786f7fb892354408e4a0e2.jar
[dx] java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
BUILD FAILED
D:\android-sdk\tools\ant\build.xml:892: The following error occurred while executing this line:
D:\android-sdk\tools\ant\build.xml:894: The following error occurred while executing this line:
D:\android-sdk\tools\ant\build.xml:906: The following error occurred while executing this line:
D:\android-sdk\tools\ant\build.xml:283: null returned: 1

Total time: 3 seconds
[dx] at java.lang.ClassLoader.defineClass1(Native Method)
[dx] at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
[dx] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
[dx] at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
[dx] at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
[dx] at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
[dx] at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[dx] at java.security.AccessController.doPrivileged(Native Method)
[dx] at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
[dx] at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
[dx] at java.lang.ClassLoader.loadClass(ClassLoader.java:412)
[dx] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
[dx] at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
[dx] at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
[dx] Exception in thread "main"

TRANS FAILED: Android build failed.
Abnormal program termination.
Exit code: -1


Difference(Posted 2016) [#11]
Unsupported major.minor version 52.0

I had the same error on Windows 10, and got Android compiles working by using the SDK manager to install the newest versions AND updating java JDK to 8u102 from http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Remember to add the path to the JDK in monkeys config file.


Snader(Posted 2016) [#12]
Thanks Difference, that seems to do it. But now I cannot get anything to run properly on my phone. It installed and then crashes. The music plays for a moment though. Never had so much trouble to run anything.; no matter what android target I am using.

Tried several JDK versions, 64bit, 32bit..

The game runs fine in HTML5.

--------- beginning of crash

08-15 21:04:38.539 18995 19015 E AndroidRuntime: FATAL EXCEPTION: GLThread 84642

08-15 21:04:38.539 18995 19015 E AndroidRuntime: Process: com.voornmultimedia.lightcyclesdueltwo, PID: 18995

08-15 21:04:38.539 18995 19015 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'int com.voornmultimedia.lightcyclesdueltwo.gxtkGraphics.SetMatrix(float, float, float, float, float, float)' on a null object reference

08-15 21:04:38.539 18995 19015 E AndroidRuntime: at com.voornmultimedia.lightcyclesdueltwo.c_GraphicsContext.p_Validate(MonkeyGame.java:4480)

08-15 21:04:38.539 18995 19015 E AndroidRuntime: at com.voornmultimedia.lightcyclesdueltwo.bb_graphics.g_DrawImage(MonkeyGame.java:6339)

08-15 21:04:38.539 18995 19015 E AndroidRuntime: at com.voornmultimedia.lightcyclesdueltwo.c_SuperLightCycles.p_OnRender(MonkeyGame.java:4063)

08-15 21:04:38.539 18995 19015 E AndroidRuntime: at com.voornmultimedia.lightcyclesdueltwo.c_GameDelegate.RenderGame(MonkeyGame.java:4321)

08-15 21:04:38.539 18995 19015 E AndroidRuntime: at com.voornmultimedia.lightcyclesdueltwo.BBGame.RenderGame(MonkeyGame.java:614)

08-15 21:04:38.539 18995 19015 E AndroidRuntime: at com.voornmultimedia.lightcyclesdueltwo.BBAndroidGame.onDrawFrame(MonkeyGame.java:1347)

08-15 21:04:38.539 18995 19015 E AndroidRuntime: at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1535)

08-15 21:04:38.539 18995 19015 E AndroidRuntime: at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

08-15 21:04:38.560 373 373 E lowmemorykiller: Error writing /proc/18995/oom_score_adj; errno=22

08-15 21:04:38.577 1818 2364 E InputDispatcher: channel '6d08062 com.voornmultimedia.lightcyclesdueltwo/com.voornmultimedia.lightcyclesdueltwo.MonkeyGame (server)' ~ Channel is unrecoverably broken and will be disposed!

08-15 21:04:38.580 1818 1901 E bsthal : <BST> disable accel, orig state: 1

08-15 21:04:38.644 400 19052 E audio_hw_primary: offload_thread_loop: Compress handle is NULL


Chugs(Posted 2016) [#13]
Where's the download for v87a? I didn't see it in my product update downloads.


Xaron(Posted 2016) [#14]
It's on the right side (experimental). There is already v87b btw.


Chugs(Posted 2016) [#15]
Yeah v87b is all I saw in the experimental list. Will this version work for the update?


Xaron(Posted 2016) [#16]
Yes.


Chugs(Posted 2016) [#17]
Exellent thanks I'll give it a whirl!


Chugs(Posted 2016) [#18]
Ok, so I installed v87b, updated the paths in my config file, and the build fails:

BUILD FAILED
C:\Program Files (x86)\android\android-sdk\tools\ant\build.xml:542: Unable to resolve project target 'android-24'

Total time: 1 second
TRANS FAILED: Android build failed.
Done.

Do I need to use a different set of build tools? API? Also, I noticed in the BRL Native folder still has The Older Version of the Admob SDK. Also, I don't have the Android (experimental) target such as in the v80c.


Xaron(Posted 2016) [#19]
You need Android SDK target API 24 installed which is Android 7.0. Open your SDK manager in the android SDK folder and install it. :)


Chugs(Posted 2016) [#20]
Ah, yes of course! Thanks Xaron! :)
What about the Admob SDK? The old one is still in the in the native folder. I need to put the new Admob folder in there Yes?
Do I need to change the paths in the Admob Module?


Xaron(Posted 2016) [#21]
No you don't need to. The old Admob SDK is obsolete the new one is hidden in the Google Play Service stuff as far as I know. At least I had nothing to add or change, just built with the new Monkey version and it worked with the new Admob stuff.


Gerry Quinn(Posted 2016) [#22]
87a seems to work fine for me.

By the way, Admob gave a month's extension - the old ad API will stay working until October.


Chugs(Posted 2016) [#23]
@Xaron, Awesome thanks! Yeah, I figured - Just wasn't sure.

@Gerry, Yeah I got that news letter. Just want to get it done - Got more apps to make! :)


Chugs(Posted 2016) [#24]
Has anyone had trouble with an app crashing/terminating when displaying interstitial ads?
I'm using the admobinterstital module contained in the Diddly framework if that helps ...


therevills(Posted 2016) [#25]
Has anyone had trouble with an app crashing/terminating when displaying interstitial ads?


Yep!!!

http://www.monkey-x.com/Community/posts.php?topic=10440


Chugs(Posted 2016) [#26]
Hey sorry to tick you off. It's a great module.I looked at the java source and I can't see whats going wrong - It should be working. I've had build where it worked fine then building again caused it to fail when calling an ad to be shown. Maybe more bugs in the Admob SDK? Hard to say ...


therevills(Posted 2016) [#27]
Hey Chugs, you didnt tick me off :)

When investigated the issue I spent hours without finding a solution apart from going back a few versions.

My guess is that it might be a threading issue somewhere in the newer MX code..


Chugs(Posted 2016) [#28]
Any luck with the interstitial module?


therevills(Posted 2016) [#29]
I'm using a slightly modified version of v84b of androidgame.java and its working okay. (You need to an import com.monkey.LangUtil; to the top of androidgame.java).

If your project is using Mojo 1 this solution is okay... if you are using Mojo 2 we need to find another solution as v84b wont work correctly with Mojo 2.


Chugs(Posted 2016) [#30]
Cool. I only use Mojo 1 at the moment - especially for updating my existing apps.
I noticed com.monkey.LangUtil is already in androidgame.java; I just simply move it to the the top?


therevills(Posted 2016) [#31]
What version of androidgame.java are you looking at?

The top of v84b looks like this:
import android.os.*;
import android.app.*;
import android.media.*;
import android.view.*;
import android.graphics.*;
import android.content.*;
import android.util.*;
import android.hardware.*;
import android.widget.*;
import android.view.inputmethod.*;
import android.content.res.*;
import android.opengl.*;
import android.text.*;

import javax.microedition.khronos.opengles.GL10;
import javax.microedition.khronos.egl.EGLConfig;

class ActivityDelegate{

	public void onStart(){


And my slightly modified one to work with 87b, the 84b looks like this with just the LangUtil added:
import android.os.*;
import android.app.*;
import android.media.*;
import android.view.*;
import android.graphics.*;
import android.content.*;
import android.util.*;
import android.hardware.*;
import android.widget.*;
import android.view.inputmethod.*;
import android.content.res.*;
import android.opengl.*;
import android.text.*;

import javax.microedition.khronos.opengles.GL10;
import javax.microedition.khronos.egl.EGLConfig;

import com.monkey.LangUtil;

class ActivityDelegate{

	public void onStart(){



Chugs(Posted 2016) [#32]
Oh, I see. I was looking at 87b. Maybe I shouldn't do this so late at night after a long day. :)

Just so I understand... Your using 84b (modified) and not 87b... and all the updates still work because of com.monkey.LangUtil?

*edit* Nevermind I can't download 84b anyway. It's not in the list. :)


therevills(Posted 2016) [#33]
Just so I understand... Your using 84b (modified) and not 87b... and all the updates still work because of com.monkey.LangUtil?

Yep.
Nevermind I can't download 84b anyway

Just checked for you, the version of androidgame.java in v83c is the same as v84b.


Chugs(Posted 2016) [#34]
Awesome! I'll look in to this after work later. Thanks therevills! :)


Chugs(Posted 2016) [#35]
Well, bad news... 83c doesn't work for me.
I might be a complete noob for saying this, but maybe the android manifest file needs more permissions? Looking up Admob Interstitial online I noticed the manifiest example had more permission lines than the basic one MonkeyX uses?

*Edit* Got 83c to work. But, Isn't this building under the older API's? It would be my recollection that we need API 24 for the latest required updates?


therevills(Posted 2016) [#36]
This is how I've done it:

1. Download the latest Monkey version (currently 87b, this has been fixed to use the new AdMob code).
2. Extract the above in a folder called Monkey87b
3. Download Monkey version 83c
4. Extract the above in a folder called Monkey83c
5. Back up Monkey87b\targets\android\modules\native\androidgame.java eg rename it to androidgame87b.java
6. Copy Monkey83c\targets\android_new\modules\native\androidgame.java over to Monkey87b\targets\android\modules\native\androidgame.java
7. Back up Monkey87b\targets\android\modules\native\androidgame.java eg copy and rename it to androidgame83c.java
8. Update Monkey87b\targets\android\modules\native\androidgame.java, by adding the import com.monkey.LangUtil;
9. Delete Monkey83c folder


Chugs(Posted 2016) [#37]
I did exactly that the first time yesterday (before my last post) knowing I needed the latest API's etc... and the build failed for some reason. Tried again from scratch today and seems to be working ok now. Thanks!