Test environment issues to implement Native Ads on flutter using intellij Idea

401 views
Skip to first unread message

Josue Tomala

unread,
Jul 24, 2023, 3:16:57 PM7/24/23
to Google Mobile Ads SDK Developers
development environment by flutter doctor:

[√] Flutter (Channel stable, 3.10.5, on Microsoft Windows [Versi¢n 10.0.19045.3208], locale es-EC) [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [√] Chrome - develop for the web [√] Visual Studio - develop for Windows (Visual Studio Professional 2022 17.6.3) [√] Android Studio (version 2022.2) [√] IntelliJ IDEA Community Edition (version 2022.1) [√] IntelliJ IDEA Ultimate Edition (version 2023.1) [√] VS Code (version 1.80.0) [√] Connected device (4 available) [√] Network resources
ADV 
Android API 33
Pixel 6 pro 6.7" 1440 x 3120 560 dpi
Tiramisu Android 13.0 x86_64


Situation.

Once I downloaded the  native_template_example and native_platform_example  projects from the github link and run pub get, in order to make the application run, in both cases the emulator shows the screen, but when I press the refresh ad button I get the errors described at the end of the post.

It should be noted that my application (it is not the same as the downloaded ones) I was able to implement correctly in tests, the Ads banner but when trying to do the nativeADs it gave me the same error. Thinking it was a problem in my code, I did the above and it also returns a very similar error.

native template error:
D/EGL_emulation(15456): app_time_stats: avg=59118.58ms min=59118.58ms max=59118.58ms count=1
I/Ads     (15456): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("BFA3C490460FA1C70A731CEDF32AD11B")) to get test ads on this device.
I/Ads     (15456): Received log message: <Google:HTML> Incorrect native ad response. Click actions were not properly specified
I/Ads     (15456): Ad failed to load : 0
I/flutter (15456): NativeAd failedToLoad: LoadAdError(code: 0, domain: com.google.android.gms.ads, message: Internal error., responseInfo: ResponseInfo(responseId: CMfvr-mDqIADFSLaKAUdu0QERg, mediationAdapterClassName: , adapterResponses: [AdapterResponseInfo(adapterClassName: com.google.ads.mediation.admob.AdMobAdapter, latencyMillis: 35, description: {
I/flutter (15456):   "Adapter": "com.google.ads.mediation.admob.AdMobAdapter",
I/flutter (15456):   "Latency": 35,
I/flutter (15456):   "Ad Source Name": "Reservation campaign",
I/flutter (15456):   "Ad Source ID": "7068401028668408324",
I/flutter (15456):   "Ad Source Instance Name": "[DevRel] [DO NOT EDIT] Native Ads Campaign",
I/flutter (15456):   "Ad Source Instance ID": "3518433842871043",
I/flutter (15456):   "Credentials": {},
I/flutter (15456):   "Ad Error": {
I/flutter (15456):     "Code": 0,
I/flutter (15456):     "Message": "Internal error.",
I/flutter (15456):     "Domain": "com.google.android.gms.ads",
I/flutter (15456):     "Cause": "null"
I/flutter (15456):   }
I/flutter (15456): }, adUnitMapping: {}, adError: AdError(code: 0, domain: com.google.android.gms.ads, message: Internal error.), adSourceName: Reservation campaign, adSourceId: 7068401028668408324, adSourceInstanceName: [DevRel] [DO NOT EDIT] Native Ads Campaign, a

Native platform error:
I/Ads     (18584): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("BFA3C490460FA1C70A731CEDF32AD11B")) to get test ads on this device.
D/EGL_emulation(18584): app_time_stats: avg=34272.34ms min=581.30ms max=67963.39ms count=2
I/Ads     (18584): Received log message: <Google:HTML> Incorrect native ad response. Click actions were not properly specified
I/Ads     (18584): Ad failed to load : 0
I/flutter (18584): NativeAd failedToLoad: LoadAdError(code: 0, domain: com.google.android.gms.ads, message: Internal error., responseInfo: ResponseInfo(responseId: CP-Wi-WEqIADFdTTKAUdfKUIPQ, mediationAdapterClassName: , adapterResponses: [AdapterResponseInfo(adapterClassName: com.google.ads.mediation.admob.AdMobAdapter, latencyMillis: 208, description: {
I/flutter (18584):   "Adapter": "com.google.ads.mediation.admob.AdMobAdapter",
I/flutter (18584):   "Latency": 208,
I/flutter (18584):   "Ad Source Name": "Reservation campaign",
I/flutter (18584):   "Ad Source ID": "7068401028668408324",
I/flutter (18584):   "Ad Source Instance Name": "[DevRel] [DO NOT EDIT] Native Ads Campaign",
I/flutter (18584):   "Ad Source Instance ID": "3518433842871043",
I/flutter (18584):   "Credentials": {},
I/flutter (18584):   "Ad Error": {
I/flutter (18584):     "Code": 0,
I/flutter (18584):     "Message": "Internal error.",
I/flutter (18584):     "Domain": "com.google.android.gms.ads",
I/flutter (18584):     "Cause": "null"
I/flutter (18584):   }
I/flutter (18584): }, adUnitMapping: {}, adError: AdError(code: 0, domain: com.google.android.gms.ads, message: Internal error.), adSourceName: Reservation campaign, adSourceId: 7068401028668408324, adSourceInstanceName: [DevRel] [DO NOT EDIT] Native Ads Campaign,



I've been looking for a solution on the internet for weeks and I can't find it, please help me to solve the issue.

It should be noted that if I followed the manual into:
https://developers.google.com/admob/flutter/native/templates?hl=es-419


Kind regards

Mobile Ads SDK Forum Advisor

unread,
Jul 24, 2023, 6:18:52 PM7/24/23
to jost...@gmail.com, google-adm...@googlegroups.com

Hi Josue,

Thank you for reaching out to us.

Upon checking our sample app (https://github.com/googleads/googleads-mobile-flutter/tree/main/packages/google_mobile_ads/example), we're able to load ads on it, and wasn't able to encounter the error you're encountering. Can you confirm if you're able to replicate it in our sample app or only in your sample app project? In addition to that, can you also provide us the following information below?

  • Sample app project if not reproducible in our sample app
  • Steps to replicate
  • App ID
  • Ad unit ID
  • Device name and version you're using

If the file(s) you are looking to share are less than 25mb in total you can attach them to this case on your next reply. If you are having trouble attaching your file to this case or if your file(s) are larger than 25mb, you can share your files with me by performing the following steps:

1. Navigate to https://docs.google.com/forms/d/e/1FAIpQLSfkAiXMeYP-fw1W3Z-tT9uwmATEKO5X6S-th0gR2ezdKaaqfg/viewform?usp=pp_url&entry.400550049=Mobile+Ads+SDK&entry.460850823=5004Q00002nS7D7QAK&entry.80707362=00189778

2. Fill out all fields, and attach your file(s).

3. Please reply back on this thread when you have uploaded your file(s). Please do not share this link.

This message is in relation to case "ref:_00D1U1174p._5004Q2nS7D7:ref"

Thanks,
 
Google Logo Mobile Ads SDK Team


Screenshot 2023-07-25 at 6.15.13 AM.png

Josue Tomala

unread,
Jul 24, 2023, 8:42:40 PM7/24/23
to Mobile Ads SDK Forum Advisor, google-adm...@googlegroups.com
Thank you so much for help me.

In fact I am using your project without making any changes.

<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3940256099942544~3347511713"/>

final String _adUnitId = Platform.isAndroid
? 'ca-app-pub-3940256099942544/2247696110'
: 'ca-app-pub-3940256099942544/3986624511';

Device name and version: ADV emulator, the exact characteristics will be located at the end of this post.

I still have problems, there must be something wrong with my configuration of the Intellij Idea programming IDE or in the use of an Android emulador. Please help.

I downloaded the link you sent me from github, opened the full path and performed the following steps:
  1. Run "Pub get" on each of the projects to install the references
  2. I configured Run/Debug of 4 projects:
  • Example:             packages\google_mobile_ads\example\lib\main.dart
  • NativeTemplate:  samples\admob\native_template_example\lib\main.dart
  • NativePlataform:  samples\admob\native_platform_example\lib\main.dart  
  • Banner:                 samples\admob\banner_example\lib\main.dart

In the case of Example, when executing I get the Multidex error, so I changed build.grandle to minSdkVersion 21 and compiled the project correctly

Example console message:
I/Ads     ( 4509): Ad failed to load : 0
I/flutter ( 4509): NativeAd failedToLoad: LoadAdError(code: 0, domain: com.google.android.gms.ads, message: Unable to obtain a JavascriptEngine., responseInfo: ResponseInfo(responseId: null, mediationAdapterClassName: , adapterResponses: [], loadedAdapterResponseInfo: null), responseExtras: {})
D/EGL_emulation( 4509): app_time_stats: avg=70.01ms min=7.13ms max=887.71ms count=20


NativeTemplate  console message:
I/Ads     ( 5823): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("BFA3C490460FA1C70A731CEDF32AD11B")) to get test ads on this device.
D/EGL_emulation( 5823): app_time_stats: avg=5124.03ms min=988.79ms max=9259.27ms count=2
I/Ads     ( 5823): Ad failed to load : 0
I/flutter ( 5823): NativeAd failedToLoad: LoadAdError(code: 0, domain: com.google.android.gms.ads, message: Unable to obtain a JavascriptEngine., responseInfo: ResponseInfo(responseId: null, mediationAdapterClassName: , adapterResponses: [], loadedAdapterResponseInfo: null), responseExtras: {})
D/EGL_emulation( 5823): eglCreateContext: 0x7cae847d7510: maj 3 min 0 rcv 3

NativePlatform  console message:
Launching lib\main.dart on sdk gphone x86 64 in debug mode...
Upgrading build.gradle
Running Gradle task 'assembleDebug'...
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
√  Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app-debug.apk...
W/FlutterEngineCxnRegstry( 6602): Attempted to register plugin (io.flutter.plugins.googlemobileads.GoogleMobileAdsPlugin@81aa982) but it was already registered with this FlutterEngine (io.flutter.embedding.engine.FlutterEngine@f8bf893).
I/Ads     ( 6602): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("BFA3C490460FA1C70A731CEDF32AD11B")) to get test ads on this device.
D/EGL_emulation( 6602): app_time_stats: avg=5335.97ms min=354.47ms max=10317.47ms count=2
D/EGL_emulation( 6602): eglCreateContext: 0x7cae847d3250: maj 3 min 0 rcv 3
I/latform_example( 6602): Background young concurrent copying GC freed 26985(2441KB) AllocSpace objects, 4(144KB) LOS objects, 31% free, 5576KB/8100KB, paused 809us,209us total 158.963ms
I/Ads     ( 6602): Ad failed to load : 0
I/Ads     ( 6602): Ad failed to load : 0
I/flutter ( 6602): NativeAd failedToLoad: LoadAdError(code: 0, domain: com.google.android.gms.ads, message: Unable to obtain a JavascriptEngine., responseInfo: ResponseInfo(responseId: null, mediationAdapterClassName: , adapterResponses: [], loadedAdapterResponseInfo: null), responseExtras: {})
I/flutter ( 6602): NativeAd failedToLoad: LoadAdError(code: 0, domain: com.google.android.gms.ads, message: Unable to obtain a JavascriptEngine., responseInfo: ResponseInfo(responseId: null, mediationAdapterClassName: , adapterResponses: [], loadedAdapterResponseInfo: null), responseExtras: {})

BANNER console message:
Launching lib\main.dart on sdk gphone x86 64 in debug mode...
Upgrading build.gradle
Running Gradle task 'assembleDebug'...
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
√  Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app-debug.apk...



For more information I add the about screen info:

IntelliJ IDEA 2023.1.3 (Ultimate Edition)
Build #IU-231.9161.38, built on June 20, 2023
Licensed to Carmen Niebla
Subscription is active until June 25, 2024.
For educational use only.
Runtime version: 17.0.7+10-b829.16 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 2028M
Cores: 8
Non-Bundled Plugins:
    Dart (231.9161.14)
    com.localizely.flutter-intl (1.18.3-2022.2)
    io.flutter (74.0.4)
Kotlin: 231-1.8.21-IJ9161.38


development environment by flutter doctor:

[√] Flutter (Channel stable, 3.10.5, on Microsoft Windows [Versi¢n 10.0.19045.3208], locale es-EC) 
[√] Windows Version (Installed version of Windows is version 10 or higher) 
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) 
[√] Chrome - develop for the web 
[√] Visual Studio - develop for Windows (Visual Studio Professional 2022 17.6.3) 
[√] Android Studio (version 2022.2) 
[√] IntelliJ IDEA Community Edition (version 2022.1) 
[√] IntelliJ IDEA Ultimate Edition (version 2023.1) 
[√] VS Code (version 1.80.0) [√] Connected device (4 available) 
[√] Network resources

Android Virtual Device 

Android API 33
Pixel 6 pro 6.7" 1440 x 3120 560 dpi
Tiramisu Android 13.0 x86_64


image.png
image.png

image.png

configuration to compile the projects

image.png

screenshot of programming IDE

image.png

Mobile Ads SDK Forum Advisor

unread,
Jul 25, 2023, 4:29:30 AM7/25/23
to jost...@gmail.com, google-adm...@googlegroups.com
Hello Josue,

We will have to share this to the wider team to provide assistance on this. Rest assured that one of our team will reach out to you.

Mobile Ads SDK Forum Advisor

unread,
Jul 25, 2023, 11:49:16 PM7/25/23
to jost...@gmail.com, google-adm...@googlegroups.com
Hi Josue,

Thank you for providing that information. I see you are using an emulator that is a Pixel 6 Pro. Does that emulator have the Google Play Store? If not, can you try creating an emulator that does and see if you can reproduce the issue? If possible, can you also try replicating your issue on a real Android device.

Thanks,
Justin

ref:_00D1U1174p._5004Q2nS7D7:ref

Josue Tomala

unread,
Jul 26, 2023, 5:08:10 PM7/26/23
to Mobile Ads SDK Forum Advisor, google-adm...@googlegroups.com
Thank you so much.

I just changed the emulator to Pixel 4, (it has a play store), with the same Tiramisu API 33 System and it actually worked perfectly.

Both the demo projects and my project.

Thank you so much



image.png

image.png
image.png

image.png

Reply all
Reply to author
Forward
0 new messages