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:
- Run "Pub get" on each of the projects to install the references
- 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