Android Question Maven Artifact not found: com.google.firebase/firebase-ads

Lyndon Bermoy

Active Member
Licensed User
Longtime User
Hi everyone, I am developing an app with adds so that I can monetize it in Google Playstore since I am broke due to covid-19. I followed all the tutorial based on Firebase admobs. But I encounter an error from opening the b4a file which says Maven Artifact not found: com.google.firebase/firebase-ads. Where can I find it? I already install B4A V.9.80 but I cannot install some updates in SDK but not all updates will download. When I tried to build the app there was no error found but the app always crashes.

Here is my code:

B4X:
#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Private BannerAd As AdView
    Private IAd As InterstitialAd

End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    ads("ca-app-pub-3940256099942544/6300978111","ca-app-pub-3940256099942544/1033173712")
End Sub


Sub Activity_Click
    'If IAd.Ready Then IAd.Show
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
Sub ads(banner As String,inter As String)
    Dim MobileAds As MobileAds
    MobileAds.Initialize
    BannerAd.Initialize2("BannerAd", banner, BannerAd.SIZE_SMART_BANNER)
    Dim height As Int
    If GetDeviceLayoutValues.ApproximateScreenSize < 6 Then
        
        If 100%x > 100%y Then height = 32dip Else height = 50dip
    Else
        height = 90dip
    End If
    Activity.AddView(BannerAd, 0dip, 100%y - height, 100%x, height)
    BannerAd.LoadAd
    
    IAd.Initialize("iad",inter)
    IAd.LoadAd
End Sub
Sub IAD_AdClosed
    IAd.LoadAd
End Sub

Manifest Editor:

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: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" 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$")
CreateResourceFromFile(Macro, Themes.DarkTheme)
'End of default text.
'Start
    CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
    CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
    CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
    CreateResourceFromFile(Macro, FirebaseAnalytics.FirebaseAnalytics)
    CreateResourceFromFile(Macro, FirebaseAdMob.FirebaseAds)
    CreateResourceFromFile(Macro, FirebaseAuth.FirebaseAuth)
   AddReplacement($ADMOB_APP_ID$,ca-app-pub-5841631477712270~9755960855) 'use your admob adunit
'endca-app-pub-5841631477712270/3948745185

Error:



SDK:




Hope you can help me solve my problem guys in putting an ads to my app. Thank you so much.
 

Xicu

Active Member
Licensed User
Longtime User
Hello @Lyndon Bermoy. First try use the forum search (it's very powerfull). There are many threads talking about this problem. I am sure that in them you will find the solution


 
Upvote 0

Lyndon Bermoy

Active Member
Licensed User
Longtime User
Thanks bro. I'll look into this one.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…