Having trouble getting admob to work with the new google play module:
B4A version: 6.00
Parsing code. (1.01s)
Compiling code. (14.87s)
Compiling layouts code. (1.70s)
Organizing libraries. (0.01s)
Generating R file. Error
AndroidManifest.xml:30: error: Error: No resource found that matches the given name (at 'value' with value '@Integer/google_play_services_version').
And most searches brings me to pre v6.00 answers.
It worked fine until I included the admob .LoadAd bit, after which it will no longer compile.
My manifest, after several attempts including reading v6.00 released page, now looks like this (not using FireBase ads, so commented that out):
It compiles with just the default part, but app crashes when it is to load an ad.
It will not compile with the first admob part and the fix to that used to be to copy over the updated google-play-services.jar but that is no longer updated / installed. (It would be nice if all old articles, no longer relevant to the last version, becomes archived or marked "no longer valid/needed from version n.nn" somehow.)
I have both api23 and api24 installed in Android SDK Manager, both updated to today, and the Extras of Google Play Services, Google Repository and Android Support Repository installed.
I commented out the line:
My ad loading sub looks like this:
B4A version: 6.00
Parsing code. (1.01s)
Compiling code. (14.87s)
Compiling layouts code. (1.70s)
Organizing libraries. (0.01s)
Generating R file. Error
AndroidManifest.xml:30: error: Error: No resource found that matches the given name (at 'value' with value '@Integer/google_play_services_version').
And most searches brings me to pre v6.00 answers.
It worked fine until I included the admob .LoadAd bit, after which it will no longer compile.
My manifest, after several attempts including reading v6.00 released page, now looks like this (not using FireBase ads, so commented that out):
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="5" android:targetSdkVersion="23"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")
'End of default text.
'SetManifestAttribute("android:installLocation", "auto")
SetManifestAttribute(android:installLocation, auto)
'AdMob
'AddApplicationText(
'<meta-data android:name="com.google.android.gms.version"
' android:value="[USER=21225]@Integer[/USER]/google_play_services_version"/>
' <activity android:name="com.google.android.gms.ads.AdActivity"
' android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
')
'End of AdMob
'InAppBilling declarations - Start
AddReceiverText(BillingService, <intent-filter>
<action android:name="com.android.vending.billing.IN_APP_NOTIFY" />
<action android:name="com.android.vending.billing.RESPONSE_CODE" />
<action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED" />
</intent-filter>)
'InAppBilling declarations - End
'************ Google Play Services Base ************
AddApplicationText(
<activity android:name="com.google.android.gms.common.api.GoogleApiActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:exported="false"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="[USER=21225]@Integer[/USER]/google_play_services_version" />
)
'************ Google Play Services Base (end) ************
'************ Firebase Ads ************
'AddApplicationText(
' <activity
' android:name="com.google.android.gms.ads.AdActivity"
' android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
' android:theme="@android:style/Theme.Translucent" />
' <activity android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity"
' android:theme="@style/Theme.IAPTheme"/>
')
'************ Firebase Ads (end) ************
It compiles with just the default part, but app crashes when it is to load an ad.
It will not compile with the first admob part and the fix to that used to be to copy over the updated google-play-services.jar but that is no longer updated / installed. (It would be nice if all old articles, no longer relevant to the last version, becomes archived or marked "no longer valid/needed from version n.nn" somehow.)
I have both api23 and api24 installed in Android SDK Manager, both updated to today, and the Extras of Google Play Services, Google Repository and Android Support Repository installed.
I commented out the line:
B4X:
'#AdditionalRes: C:\Program Files\Android\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms
My ad loading sub looks like this:
B4X:
MainAdView.Initialize("Ad", "ca-app-pub-nnnnnnnnnnn/nnnnnnnn")
If CommercialAdLabel.Height < 50dip Then
Activity.AddView(MainAdView, CommercialAdLabel.Left, CommercialAdLabel.Top, CommercialAdLabel.Width, 50dip)'CommercialAdLabel.Height)
Else
Activity.AddView(MainAdView, CommercialAdLabel.Left, CommercialAdLabel.Top, CommercialAdLabel.Width, CommercialAdLabel.Height)
End If
MainAdView.LoadAd 'loads an ad
Last edited: