Android Question Google Ad Mob Upgrade Error

Marcos Alves

Well-Known Member
Licensed User
Longtime User
Hello all,
I'm trying to update a very old app published on Google Play to the new version of B4A, but when compiling the code (generated in b4A 5 years ago), I'm getting the error:

Cannot find: C:\Program Files (x86)\Anywhere Software\Basic4android\libraries\googleadmobadssdk.jar

I know that today I only need to reference the lib Admob... then, I deleted from manifest every reference to the jar file, but I'm still getting the same error.
Does anybody know how could be happening? This is the manifest... thanks!!!

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="26"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.

'Contacts
AddPermission("android.permission.READ_CONTACTS")
AddPermission("android.permission.WRITE_CONTACTS") 'if write access is required
AddPermission("android.permission.READ_PHONE_STATE")
'End Contacts
 

walterf25

Expert
Licensed User
Longtime User
Hello all,
I'm trying to update a very old app published on Google Play to the new version of B4A, but when compiling the code (generated in b4A 5 years ago), I'm getting the error:

Cannot find: C:\Program Files (x86)\Anywhere Software\Basic4android\libraries\googleadmobadssdk.jar

I know that today I only need to reference the lib Admob... then, I deleted from manifest every reference to the jar file, but I'm still getting the same error.
Does anybody know how could be happening? This is the manifest... thanks!!!

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="26"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.

'Contacts
AddPermission("android.permission.READ_CONTACTS")
AddPermission("android.permission.WRITE_CONTACTS") 'if write access is required
AddPermission("android.permission.READ_PHONE_STATE")
'End Contacts
You need to follow this Tutorial here.
https://www.b4x.com/android/forum/t...b-ads-integrated-with-firebase-backend.67710/
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Thanks @walterf25 ... But what if I don't want to integrate with Firebase maintaining only the admob as it is in the original code ? Is It still possible with b4a ?
The old admob library does not work anymore, you need to use firebase admob.

Walter
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
you can use a minimal firebase implementation if you only use admob without the need to register for firebase or add your apps to it.

you only need to use this in your manifest file if you don't need all the rest.

B4X:
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAdMob.FirebaseAds)
 
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
you can use a minimal firebase implementation if you only use admob without the need to register for firebase or add your apps to it.

you only need to use this in your manifest file if you don't need all the rest.

B4X:
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAdMob.FirebaseAds)
Thanks @sorex . Thats it! I'll test!
 
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
Ok, worked! The adbob error is fixed BUT I'm still getting the error:

AndroidManifest.xml:30: error: Error: No resource found that matches the given name (at 'value' with value '@Integer/google_play_services_version').
AndroidManifest.xml:37: error: Error: No resource found that matches the given name (at 'theme' with value '@style/Theme.IAPTheme').

Manifest doesn't have line 30 nor 37 and so, I think that it's something about the standard manifest "hidden" created by B4A old version... does anybody can help?
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
the theme one is probably because you point to an android.jar file that's too old (API <21?)
 
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
the theme one is probably because you point to an android.jar file that's too old (API <21?)
Ok, but how can I change this? I can't see the lines 30 and 37 in Manifest... It looks that it's something "hard coded" in b4A old implementation...
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
Tools > Configure paths

point to something that's 21 or higher.

the theme is probably part of some lib
 
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
Tools > Configure paths

point to something that's 21 or higher.

the theme is probably part of some lib
It's already pointing to api level 28...

upload_2019-1-5_10-38-28.png
 

Attachments

  • upload_2019-1-5_10-38-17.png
    upload_2019-1-5_10-38-17.png
    34.5 KB · Views: 223
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
can you post your entire manifest?
that's it:
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="26"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.

CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAdMob.FirebaseAds)

'Contacts
AddPermission("android.permission.READ_CONTACTS")
AddPermission("android.permission.WRITE_CONTACTS") 'if write access is required
AddPermission("android.permission.READ_PHONE_STATE")
'End Contacts
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
that seems to be fine.

I suggest you create a new project with only this manifest and the admob code.

If that works it's probably something in your project that causes that error (a lib).
 
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
that seems to be fine.

I suggest you create a new project with only this manifest and the admob code.

If that works it's probably something in your project that causes that error (a lib).
That's what I was thinking to do... I'll test to import the code to a new project...
 
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
that seems to be fine.

I suggest you create a new project with only this manifest and the admob code.

If that works it's probably something in your project that causes that error (a lib).
Ok... problem again. I created a completely new project and imported the modules from the old one... and got the SAME error.

AndroidManifest.xml:30: error: Error: No resource found that matches the given name (at 'value' with value '@Integer/google_play_services_version').
AndroidManifest.xml:37: error: Error: No resource found that matches the given name (at 'theme' with value '@style/Theme.IAPTheme').

Crazy!!!! I really can't find any reference to theme or google play service in any piece of code! Suggestions ?
 
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
that's it:
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="26"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.

CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAdMob.FirebaseAds)

'Contacts
AddPermission("android.permission.READ_CONTACTS")
AddPermission("android.permission.WRITE_CONTACTS") 'if write access is required
AddPermission("android.permission.READ_PHONE_STATE")
'End Contacts

oK, I decided to check the /object/AndroidManifest.xml and found the lines 30 and 37 there... but it looks that these lines are in metadata, present on all B4A apps. Then, I concluded that probably the error is something in modules created in the old version, and maybe there is no way to fix it instead of creating new modules in the new version, with the same names, and cut/paste the code... a #LOT# of work to be done:( If anybody has any suggestion that could help I will be really very grateful ! Thanks!
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
does that manifest get overwritten?

wasn't it that you had to make it readonly or something before the manifest editor was implemented in B4A?

remove it and it will be created again with what you entered in B4A
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
Did you have in-app purchases in your app?

I have that theme thing in an app that has an in-app purchase to remove ads.

B4X:
          <activity android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity"
          android:theme="@style/Theme.IAPTheme"/>
 
Upvote 0
Top