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
 

Marcos Alves

Well-Known Member
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
Hello,
I did exactly that. I removed and B4A created again the same.
 
Upvote 0

Marcos Alves

Well-Known Member
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"/>
Yes, I have in app purchases... But I don't have theme referencing lines in the manifest... I'll try to put that lines... Maybe fix the error... Who knows...
 
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
You don't need to remove any library. Are you using B4A Sdk Manager to manage the SDK?

Can you post the manifest editor code?
Hello @Erel ... yes, I'm using the sdk manager. Follows the entire manifest editor code:
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

Marcos Alves

Well-Known Member
Licensed User
Longtime User
BTW, you are missing the important theme line:
B4X:
CreateResourceFromFile(Macro, Themes.DarkTheme)

Please create a new project and add the two libraries with the required configuration. Are you able to compile?
Thanks @Erel . I added the manifest line . It was also missing the FirebaseAdMob library (I didn't noticed because that wasn't required in the old version) ... When I added, the error message has changed to:
B4X:
B4A Version: 8.30
Parsing code.    (0.03s)
Compiling code.    (0.39s)
    
ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code.    (0.01s)
Organizing libraries.    (3.18s)
Generating R file.    (1.55s)
Compiling generated Java code.    Error
Cannot find: C:\Program Files (x86)\Anywhere Software\Basic4android\libraries\googleadmobadssdk.jar

The libs those I'm using in the project are:

upload_2019-1-6_21-11-18.png


Is it required to have the file googleadmobadssdk.jar in the in the libs directory???
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Thanks @Erel . I added the manifest line . It was also missing the FirebaseAdMob library (I didn't noticed because that wasn't required in the old version) ... When I added, the error message has changed to:
B4X:
B4A Version: 8.30
Parsing code.    (0.03s)
Compiling code.    (0.39s)
   
ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code.    (0.01s)
Organizing libraries.    (3.18s)
Generating R file.    (1.55s)
Compiling generated Java code.    Error
Cannot find: C:\Program Files (x86)\Anywhere Software\Basic4android\libraries\googleadmobadssdk.jar

The libs those I'm using in the project are:

View attachment 76038

Is it required to have the file googleadmobadssdk.jar in the in the libs directory???
If you're using the FireBaseAdmob library you don't need the old admob library.

Walter
 
Upvote 0

Marcos Alves

Well-Known Member
Licensed User
Longtime User
If you're using the FireBaseAdmob library you don't need the old admob library.

Walter
Thanks @walterf25 . Worked! Thanks @Erel and @sorex also. Each tip from all of you helped me to convert this old code to the new version. I had a problem in app store because really the old code used some permissions those today are considered sensible. With the new compilation, I'll be able to maintain this app, that has more than 5000 downloads and 6 years, available on Play Store. This is the real power of B4A - the community working together.
 
Upvote 0
Top