Android Question admob problem

boralogy

Member
Licensed User
Longtime User
I read forum content about admob , but my app crash after I compile it. Could you help?
I downloaded latest SDK for android and do all steps for google play services but still Dim AdView1 As AdView basic 4 android gives error for Adview.



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
    #AdditionalRes: C:\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms
#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.
Dim p As PhoneIntents
Dim AdView1 As AdView

    Dim ensonhaber As Button
    Dim haber7 As Button
    Dim haberler As Button
    Dim haberturk As Button
    Dim hurriyet As Button
    Dim milliyet As Button
    Dim zaman As Button
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("main")
AdView1.Initialize("footer_banner", "<ca-app-pub-6837661402850267/5510137832>")
    Activity.AddView(AdView1, 0dip, 0dip, 320dip, 50dip)' AdView1.LoadAd 'loads an ad

   AdView1.LoadAd
End Sub

Sub Activity_Resume
AdView1.Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
AdView1.Pause
End Sub

Sub Ad_FailedToReceiveAd (ErrorCode As String)
    Log("failed: " & ErrorCode)
End Sub
Sub Ad_ReceiveAd
    Log("received")
End Sub
Sub Ad_AdScreenDismissed
   Log("screen dismissed")
End Sub


Sub zaman_Click
    StartActivity(p.OpenBrowser("http://www.zaman.com.tr"))
End Sub
Sub milliyet_Click
    StartActivity(p.OpenBrowser("http://www.milliyet.com.tr"))
End Sub
Sub hurriyet_Click
    StartActivity(p.OpenBrowser("http://www.hurriyet.com.tr"))
End Sub
Sub haberturk_Click
    StartActivity(p.OpenBrowser("http://www.haberturk.com/"))
End Sub
Sub haberler_Click
    StartActivity(p.OpenBrowser("http://www.haberler.com/"))
End Sub
Sub haber7_Click
    StartActivity(p.OpenBrowser("http://www.haber7.com/"))
End Sub
Sub ensonhaber_Click
    StartActivity(p.OpenBrowser("http://www.ensonhaber.com/"))
End Sub
 

Attachments

  • f1.JPG
    f1.JPG
    79.9 KB · Views: 103
  • appstopped.JPG
    appstopped.JPG
    29.1 KB · Views: 104
Last edited:
Top