Using admob ads in processing


#1

Hi everyone, I’m trying to use admob in my app, I downloaded this simple code: Implementing ads with admob
with the jar file and xml file. It’s compiled and built without any problem but, it’s crashes after installing, as my device says “adstest stopped working”, and I don’t get any errors on the consol. Please help me


#2

@boldi999 ====

can you put here your Manifest?


#3

here it is:

<?xml version="1.0" encoding="UTF-8"?>

#4
<?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="28"/>
    <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="8298000"/>
    </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>


#5

@boldi999===
one missing line after the second one in your manifest: android:versionName (probably “1.0”, versionCode (probably 1° , package:“com.akenaton.yourpackagename” (of course change it!!!) - these infos are crucial when you create an apk…
see here: https://developer.android.com/guide/topics/manifest/manifest-intro#package-name
ps/ That is for AS; with p5 its possible that it generates the package name from some template:“processing.test.your appname” ; any way this line must be present


#6

Thanks for helping me
I already put the version name, code. In other apps it worked every time with package:"" (just an empty “”)
Sorry I don’t understand, where can I find the package name?

<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="8298000"/>
</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>

#7

@boldi999 ====
Sorry, i have looked too quickly to your manifest and not seen the end of the first line! - So, thinking that P5 generates the package name (or application id in the build gradle) it seems ok and that is not the cause of the error; of course i suppose that the value for gms version is the good one! - In this case i would like to know what is the jar you are using (version?) - Was it in the xml you talked about?
looking better to your gms value i have a doubt: it looks like the version number of the jar itself!


#8

Ok I’ll check the package name anyway.
I don’t know which version is this jar file ,where can I see it? I downloaded it in a rar file with xml and code so in the xml that gsm value was already there.
Can it work with other jar files?

here is the rar file:
https://drive.google.com/file/d/106YJchXlfUjKt_lB5Uw7GHKKLfmYCSzH/view?usp=sharing


#9

@boldi999 ===
i have downloaded it; first thing: the code is mine and as i have saved it on my computer i am sure! - Secondly: i cannot see any xml except the Manifest… which is not the same as my one: the gms value is #. Thirdly this jar is an old one (2015) and probably 26_27_28 version. I think that the guy who posted this rar has misunderstood the value which normally, is in the Googlelib in the SDK inside an XML called “values.xml” and has nothing to see with the jar version. Perhaps you can ask him where he has found this value…


#10

So if I know the gsm value It will work with this old jar?
If I won’t find the gsm value can you send me your jar file with the gsm value?


#11

@boldi999===
yes, if you have the right value it must work
as for sending the old jar that depends: since, i have probably updated my sdk a lot of times… Yet, if i do remember you can find old versions here= https://stackoverflow.com/questions/20982533/how-to-download-older-google-play-services
and looking to its rev number for r28 you can find the number which is in your Manifest and IS NOT the values.xml…


#12

So I downloaded the r28 jar, but it’s a zip file. In zip format it isn’t work so Is that good if I convert it to jar? Then I just put it to the sketch “data” folder?


#13

@boldi999===
just change the suffix, put.jar instead of .zip, then put it inside a code folder(not data folder)
before unzipping look at the number right of r28: it is what you have for now in the Manifest and it is not the value for gms. He who wrote this Manifest was wrong… Now try to google for finding the real one: good luck! -


#14

Ok, but I didn’t find the manifest in the zip. Is this should be in the root directory? Where can I find it and in what kind of file forat?


#15

@boldi999===
sure! there is no Manifest here: the other one was added by the guy who made the package…Yet that is not a problem, you can use the Manifest you have put here, except for the value, which is not the good one.


#16

okay, if I understand, I put my manifest (which I put here) into the zip file (which I renamed to .jar) and there will be an another manifest in the sketch folder, the same as in the jar, and of course I change the value.
So that mean the 2 manifests are will be the same?


#17

@boldi999===
not at all!
you create a code folder in your sketch folder
in this folder you put the zip file (renamed as .jar without doing nothing else
then you modify your manifest according to the values and put it as usually!
the “other” Manifest, put in the zip file from the user, has not any interest and is value is wrong!