Android Question [ solved ] using FirebaseAdMob ,App crash

Maodge

Member
Licensed User
I developed the app for the first time.
I didn't know that some information of admob needed to be kept secret.
I leaked my AdMob related information on the forum.
somebody using my admob appid information ,
Now my AdMob has been blocked.
Once again, I would like to remind :
Do not to disclose information on the forum.


''''''''''''''''''
hi,
I create a simple test project to study using FirebaseAdMob Lib.
Using Huawei Honor,Android Ver 8.1.0 for debug.
This project can compile ok, but the app immediately crashes.

I read the following post
And check the project package name , appid,
google-services.json, sdk manager,code etc.
but i can not find the bug.
Could anyone give some suggest ? Thanks!

----
i debug on emulator, and get err logs. On emulator, test project crashes again.


APPID

1587088757639.png

code below
Code: Copy
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseAdMob.FirebaseAds)

'This is a sample AdMob app id. You need to change it to your id.
AddReplacement($ADMOB_APP_ID$, ca-app-pub-xxxxxxxxxxxxxxxx)

Code: Copy
Sub Service_Create
    'This is the program entry point.
    'This is a good place to load resources that are not specific to a single activity.
    Dim MobileAds As MobileAds
    MobileAds.Initialize
End Sub
Code: Copy
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 Label1 As Label
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("1")

    BannerAd.Initialize2("BannerAd", "ca-app-pub-xxxxxxxxxxxx", BannerAd.SIZE_SMART_BANNER)
    Activity.AddView(BannerAd, 0dip, 100%y - 48dip, 100%x, 48dip)
    BannerAd.LoadAd
End Sub

complie log:
B4A Version: 9.80
Java Version: 11
Parsing code. (0.00s)
Building folders structure. (0.05s)
Compiling code. (0.03s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
(AndroidX SDK)
Generating R file. (0.00s)
Compiling debugger engine code. (0.00s)
Compiling generated Java code. (0.08s)
Convert byte code - optimized dex. (12.40s)
Packaging files. (2.99s)
Copying libraries resources (0.08s)
Found 24 resource files.
Signing package file (debug key). (2.10s)
ZipAlign file. (0.22s)
Installing file to device. (0.21s)
Installing with B4A-Bridge.
Completed successfully.
 

Attachments

Last edited:
No Log print.
When i click run on huawei phone, then it crashes.
Nothing output in logs .
even the information of connect to phone
"Logger connected to: HUAWEI BKK-AL10" is not dispaly.

Is it because of Google forbidden Huawei and China forbidden Google ?:eek:
It seems that i can not use this lib for above reason.
 
Upvote 0
No Log print.
When i click run on huawei phone, then it crashes.
Nothing output in logs .
even the information of connect to phone
"Logger connected to: HUAWEI BKK-AL10" is not dispaly.

Is it because of Google forbidden Huawei and China forbidden Google ?:eek:
It seems that i can not use this lib for above reason.
I don't think so,
i tried the project on an Emulator without Google Play Services and it worked

Change Release to Debug to be able to see the error log or add this line to your Project Attributes
B4X: Copy
#BridgeLogger:True
 
Upvote 0
I don't think so,
i tried the project on an Emulator without Google Play Services and it worked

Change Release to Debug to be able to see the error log or add this line to your Project Attributes
B4X: Copy
#BridgeLogger:True

I tested it according to your advice.
And debug on emulator.
It crash. This time I get err log. but I don't know err log means.
some fail log as
"Class com.google.android.gms.internal.ads.zzajk failed lock verification and will run slower."
...
com.google.android.gms.internal.ads.zzazx: com.google.android.gms.dynamite.DynamiteModule$LoadingException: Failed to instantiate module class: com.google.android.gms.ads.measurement.DynamiteMeasurementManager
...
Failed to find provider info for com.google.android.gms.chimera
Failed to load IDynamiteLoader from GmsCore: Application package com.google.android.gms not found
...
 

Attachments

Upvote 0
1. Use B4A Sdk Manager tool to install all recommended items.


 
Upvote 0
Thanks Kzero and Erel
I re-install IDE, and use sdk manager install all recommended items.
Test project works well.
 
Upvote 0
Back
Top