googleads / googleads-mobile-flutter

A Flutter plugin for the Google Mobile Ads SDK
Apache License 2.0
340 stars 282 forks source link

RewardedAd stop showing after app resumed on real device - Samsung #1029

Closed tavyDesign closed 6 months ago

tavyDesign commented 6 months ago

[REQUIRED] Step 1: Describe your environment

On Samsung real device, after app is resumed, RewardedAd failed to load, these are logs:

W/Ads     (28543): Rewarded ads that show when your app is in the background are a violation of AdMob policies and may lead to blocked ad serving. To learn more, visit ...

I/flutter (28543): Instance of 'RewardedAd' onAdFailedToShowFullScreenContent: AdError(code: 3, domain: com.google.android.gms.ads, message: The ad can not be shown when app is not in foreground.)

Plugin Version

google_mobile_ads: ^4.0.0

[REQUIRED] Step 2: Describe the problem

Steps to Reproduce

  1. Open app
  2. Put app in background (lock / unlock phone, go to homescreen, switch to another app... for example)
  3. Go back to app
  4. When call RewardedAd to show, it failed (log: The ad can not be shown when app is not in foreground)

Expected results:

Load RewardedAd

Actual results:

Error: Instance of 'RewardedAd' onAdFailedToShowFullScreenContent: AdError(code: 3, domain: com.google.android.gms.ads, message: The ad can not be shown when app is not in foreground.)

Logs ``` [ +21 ms] I/ViewRootImpl@a89624a[MainActivity](30381): [DP] pd() Asnyc report [ +12 ms] I/SurfaceView(30381): setParentSpaceRectangle: useBLAST = false position = Rect(0, 0 - 1080, 2196) frameNumber = 1 t = android.view.SurfaceControl$Transaction@87ba1c7 [ ] I/SurfaceView(30381): applySurfaceTransforms: t = android.view.SurfaceControl$Transaction@87ba1c7 surfaceControl = Surface(name=SurfaceView - com.app.drpciv_examen/com.app.drpciv_examen.MainActivity@48df59e@0)/@0x6c854d frame = 1 [ ] I/SurfaceView(30381): applySurfaceTransforms: postScaleX = 1.0 postScaleY = 1.0 [ +44 ms] I/ViewRootImpl@a89624a[MainActivity](30381): [DP] pdf(0) 1 android.view.ViewRootImpl.lambda$performDraw$1$ViewRootImpl:4668 android.view.-$$Lambda$ViewRootImpl$DJd0VUYJgsebcnSohO6h8zc_ONI.run:6 android.os.Handler.handleCallback:938 [ ] I/ViewRootImpl@a89624a[MainActivity](30381): [DP] rdf() [ +29 ms] I/ViewRootImpl@a89624a[MainActivity](30381): MSG_WINDOW_FOCUS_CHANGED 1 1 [ ] D/InputMethodManager(30381): prepareNavigationBarInfo() DecorView@5ee28f9[MainActivity] [ ] D/InputMethodManager(30381): getNavigationBarColor() -855310 [ ] D/InputMethodManager(30381): prepareNavigationBarInfo() DecorView@5ee28f9[MainActivity] [ ] D/InputMethodManager(30381): getNavigationBarColor() -855310 [ ] V/InputMethodManager(30381): Starting input: tba=com.app.drpciv_examen ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false [ +1 ms] D/InputMethodManager(30381): startInputInner - Id : 0 [ ] I/InputMethodManager(30381): startInputInner - mService.startInputOrWindowGainedFocus [ +11 ms] D/InputTransport(30381): Input channel constructed: 'ClientS', fd=238 [ +2 ms] D/InputMethodManager(30381): prepareNavigationBarInfo() DecorView@5ee28f9[MainActivity] [ ] D/InputMethodManager(30381): getNavigationBarColor() -855310 [ ] V/InputMethodManager(30381): Starting input: tba=com.app.drpciv_examen ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false [ ] D/InputMethodManager(30381): startInputInner - Id : 0 [ +13 ms] I/SurfaceControl(30381): nativeRelease nativeObject s[502325516800] [ ] I/SurfaceControl(30381): nativeRelease nativeObject e[502325516800] [ ] I/SurfaceControl(30381): nativeRelease nativeObject s[502325514016] [ ] I/SurfaceControl(30381): nativeRelease nativeObject e[502325514016] [ +17 ms] D/ProfileInstaller(30381): Installing profile for com.app.drpciv_examen [+1136 ms] I/p.drpciv_exame(30381): Background concurrent copying GC freed 6583(828KB) AllocSpace objects, 24(4488KB) LOS objects, 49% free, 7355KB/14MB, paused 217us total 152.115ms [ +249 ms] I/Ads (30381): JS: The jsLoaded GMSG has been sent (https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/production/sdk-core-v40-impl.html:789) [ ] I/chromium(30381): [INFO:CONSOLE(789)] "The jsLoaded GMSG has been sent", source: https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/production/sdk-core-v40-impl.html (789) [ +473 ms] I/ExoPlayerImpl(30381): Init 7f0f574 [AndroidXMedia3/1.2.1] [a40, SM-A405FN, samsung, 30] [ +22 ms] W/p.drpciv_exame(30381): Accessing hidden method Landroid/media/AudioTrack;->getLatency()I (greylist, reflection, allowed) [ +57 ms] I/Ads (30381): ExoPlayerAdapter initialized. [ +482 ms] W/ServiceManager(30381): Permission failure: android.permission.MODIFY_PHONE_STATE from uid=10305 pid=30381 [ +1 ms] I/AudioSystem(30381): Permission Denied cuid=10305 param=l_uhq_active_enable [ +5 ms] W/ServiceManager(30381): Permission failure: android.permission.MODIFY_PHONE_STATE from uid=10305 pid=30381 [ ] I/AudioSystem(30381): Permission Denied cuid=10305 param=l_uhq_active_enable [ +42 ms] I/CCodec (30381): state->set(ALLOCATING) [ ] I/CCodec (30381): allocate(c2.android.aac.decoder) [ ] I/Codec2Client(30381): Available Codec2 services: "default" "software" [ ] I/CCodec (30381): setting up 'default' as default (vendor) store [ +47 ms] I/CCodec (30381): Created component [c2.android.aac.decoder] [ ] I/CCodec (30381): state->set(ALLOCATED) [ ] D/CCodecConfig(30381): read media type: audio/mp4a-latm [ +7 ms] D/ReflectedParamUpdater(30381): extent() != 1 for single value type: algo.buffers.max-count.values [ ] D/ReflectedParamUpdater(30381): extent() != 1 for single value type: output.subscribed-indices.values [ ] D/ReflectedParamUpdater(30381): extent() != 1 for single value type: input.buffers.allocator-ids.values [ ] D/ReflectedParamUpdater(30381): extent() != 1 for single value type: output.buffers.allocator-ids.values [ ] D/ReflectedParamUpdater(30381): extent() != 1 for single value type: algo.buffers.allocator-ids.values [ ] D/ReflectedParamUpdater(30381): extent() != 1 for single value type: output.buffers.pool-ids.values [ ] D/ReflectedParamUpdater(30381): extent() != 1 for single value type: algo.buffers.pool-ids.values [ +3 ms] I/CCodecConfig(30381): query failed after returning 19 values (BAD_INDEX) [ ] D/CCodecConfig(30381): c2 config diff is Dict { [ ] D/CCodecConfig(30381): c2::u32 coded.aac-packaging.value = 0 [ ] D/CCodecConfig(30381): c2::u32 coded.bitrate.value = 64000 [ ] D/CCodecConfig(30381): c2::u32 coded.pl.level = 0 [ ] D/CCodecConfig(30381): c2::u32 coded.pl.profile = 8192 [ ] D/CCodecConfig(30381): c2::i32 coding.drc.album-mode.value = 0 [ ] D/CCodecConfig(30381): c2::float coding.drc.attenuation-factor.value = 1 [ ] D/CCodecConfig(30381): c2::float coding.drc.boost-factor.value = 1 [ ] D/CCodecConfig(30381): c2::i32 coding.drc.compression-mode.value = 3 [ ] D/CCodecConfig(30381): c2::i32 coding.drc.effect-type.value = 3 [ ] D/CCodecConfig(30381): c2::float coding.drc.encoded-level.value = 0.25 [ ] D/CCodecConfig(30381): c2::float coding.drc.reference-level.value = -16 [ ] D/CCodecConfig(30381): c2::u32 input.buffers.max-size.value = 8192 [ ] D/CCodecConfig(30381): c2::u32 input.delay.value = 0 [ ] D/CCodecConfig(30381): string input.media-type.value = "audio/mp4a-latm" [ ] D/CCodecConfig(30381): c2::u32 output.delay.value = 2 [ ] D/CCodecConfig(30381): c2::float output.drc.output-loudness.value = 0.25 [ ] D/CCodecConfig(30381): string output.media-type.value = "audio/raw" [ ] D/CCodecConfig(30381): c2::u32 raw.channel-count.value = 1 [ ] D/CCodecConfig(30381): c2::u32 raw.max-channel-count.value = 8 [ ] D/CCodecConfig(30381): c2::u32 raw.sample-rate.value = 44100 [ ] D/CCodecConfig(30381): } [ ] D/MediaCodec(30381): flushMediametrics [ ] D/CCodec (30381): [c2.android.aac.decoder] buffers are bound to CCodec for this session [ ] D/CCodec (30381): can't get width [ ] D/CCodec (30381): can't get height [ ] I/CCodec (30381): appPid(30381) width(0) height(0) [ ] D/CCodecConfig(30381): no c2 equivalents for flags [ ] D/CCodecConfig(30381): c2 config diff is c2::u32 raw.channel-count.value = 2 [ ] W/Codec2Client(30381): query -- param skipped: index = 1107298332. [ ] D/CCodec (30381): setup formats input: AMessage(what = 0x00000000) = { [ ] D/CCodec (30381): int32_t aac-drc-album-mode = 0 [ ] D/CCodec (30381): int32_t aac-drc-boost-level = 127 [ ] D/CCodec (30381): int32_t aac-drc-cut-level = 127 [ ] D/CCodec (30381): int32_t aac-drc-effect-type = 3 [ ] D/CCodec (30381): int32_t aac-drc-heavy-compression = 3 [ ] D/CCodec (30381): int32_t aac-encoded-target-level = -1 [ ] D/CCodec (30381): int32_t aac-max-output-channel_count = 8 [ ] D/CCodec (30381): int32_t aac-target-ref-level = 64 [ ] D/CCodec (30381): int32_t channel-count = 2 [ ] D/CCodec (30381): int32_t level = 0 [ ] D/CCodec (30381): int32_t max-input-size = 8192 [ ] D/CCodec (30381): string mime = "audio/mp4a-latm" [ ] D/CCodec (30381): int32_t profile = 2 [ ] D/CCodec (30381): int32_t sample-rate = 44100 [ ] D/CCodec (30381): int64_t durationUs = 0 [ ] D/CCodec (30381): } and output: AMessage(what = 0x00000000) = { [ ] D/CCodec (30381): int32_t aac-drc-album-mode = 0 [ ] D/CCodec (30381): int32_t aac-drc-boost-level = 127 [ ] D/CCodec (30381): int32_t aac-drc-cut-level = 127 [ ] D/CCodec (30381): int32_t aac-drc-effect-type = 3 [ ] D/CCodec (30381): int32_t aac-drc-heavy-compression = 3 [ ] D/CCodec (30381): int32_t aac-drc-output-loudness = -1 [ ] D/CCodec (30381): int32_t aac-encoded-target-level = -1 [ ] D/CCodec (30381): int32_t aac-max-output-channel_count = 8 [ ] D/CCodec (30381): int32_t aac-target-ref-level = 64 [ ] D/CCodec (30381): int32_t channel-count = 2 [ ] D/CCodec (30381): string mime = "audio/raw" [ ] D/CCodec (30381): int32_t sample-rate = 44100 [ ] D/CCodec (30381): } [ +4 ms] I/CCodec (30381): state->set(STARTING) [ ] W/Codec2Client(30381): query -- param skipped: index = 1342179345. [ ] W/Codec2Client(30381): query -- param skipped: index = 2415921170. [ ] W/Codec2Client(30381): query -- param skipped: index = 1610614798. [ ] E/FMQ (30381): grantorIdx must be less than 3 [ ] E/FMQ (30381): grantorIdx must be less than 3 [ ] D/CCodecBufferChannel(30381): [c2.android.aac.decoder#951] Created input block pool with allocatorID 16 => poolID 17 - OK (0) [ ] I/CCodecBufferChannel(30381): [c2.android.aac.decoder#951] Created output block pool with allocatorID 16 => poolID 141 - OK [ +3 ms] D/CCodecBufferChannel(30381): [c2.android.aac.decoder#951] Configured output block pool ids 141 => OK [ ] I/CCodec (30381): state->set(RUNNING) [ +1 ms] E/ion (30381): ioctl c0044901 failed with code -1: Invalid argument [ ] I/CCodecBufferChannel(30381): [c2.android.aac.decoder#951] 4 initial input buffers available [ ] E/FMQ (30381): grantorIdx must be less than 3 [ +43 ms] E/FMQ (30381): grantorIdx must be less than 3 [ +2 ms] D/CCodecConfig(30381): c2 config diff is c2::i32 coding.drc.compression-mode.value = 1 [ ] D/CCodecBuffers(30381): [c2.android.aac.decoder#951:Output[N]] popFromStashAndRegister: at 1000000000000us, output format changed to AMessage(what = 0x00000000) = { [ ] D/CCodecBuffers(30381): int32_t aac-drc-album-mode = 0 [ ] D/CCodecBuffers(30381): int32_t aac-drc-boost-level = 127 [ ] D/CCodecBuffers(30381): int32_t aac-drc-cut-level = 127 [ ] D/CCodecBuffers(30381): int32_t aac-drc-effect-type = 3 [ ] D/CCodecBuffers(30381): int32_t aac-drc-heavy-compression = 1 [ ] D/CCodecBuffers(30381): int32_t aac-drc-output-loudness = -1 [ ] D/CCodecBuffers(30381): int32_t aac-encoded-target-level = -1 [ ] D/CCodecBuffers(30381): int32_t aac-max-output-channel_count = 8 [ ] D/CCodecBuffers(30381): int32_t aac-target-ref-level = 64 [ ] D/CCodecBuffers(30381): int32_t channel-count = 2 [ ] D/CCodecBuffers(30381): string mime = "audio/raw" [ ] D/CCodecBuffers(30381): int32_t sample-rate = 44100 [ ] D/CCodecBuffers(30381): } [ +10 ms] I/ACodec (30381): [] Now uninitialized [ ] I/ACodec (30381): [] onAllocateComponent [ +1 ms] I/OMXClient(30381): IOmx service obtained [ +16 ms] I/ACodec (30381): [OMX.Exynos.vp9.dec] Now Loaded [ +3 ms] D/MediaCodec(30381): flushMediametrics [ ] D/SurfaceUtils(30381): connecting to surface 0x74cb9d3010, reason connectToSurface [ ] I/MediaCodec(30381): [OMX.Exynos.vp9.dec] setting surface generation to 31110145 [ ] D/SurfaceUtils(30381): disconnecting from surface 0x74cb9d3010, reason connectToSurface(reconnect) [ ] D/SurfaceUtils(30381): connecting to surface 0x74cb9d3010, reason connectToSurface(reconnect) [ ] I/ACodec (30381): app-pid(30381) [ ] I/ACodec (30381): can't find wfdsink-exynos-enable [ +3 ms] W/ACodec (30381): [OMX.Exynos.vp9.dec] setting HDRStaticInfo failed even though codec advertises support [ ] I/ACodec (30381): packageName : com.app.drpciv_examen [ ] I/ACodec (30381): codec does not support config priority (err -1010) [ +2 ms] W/ACodec (30381): [OMX.Exynos.vp9.dec] getting HDRStaticInfo failed even though codec advertises support [ +14 ms] I/ACodec (30381): [OMX.Exynos.vp9.dec] Now Loaded->Idle [ +21 ms] D/SurfaceUtils(30381): set up nativeWindow 0x74cb9d3010 for 640x360, color 0x105, rotation 0, usage 0x402900 [ ] I/ACodec (30381): [OMX.Exynos.vp9.dec] configureOutputBuffersFromNativeWindow setBufferCount : 9, minUndequeuedBuffers : 5 [ +3 ms] I/ACodec (30381): [OMX.Exynos.vp9.dec] Now Idle->Executing [ +1 ms] I/MediaCodec(30381): setCodecState state : 0 [ ] I/ACodec (30381): [OMX.Exynos.vp9.dec] Now Executing [ +5 ms] W/Gralloc4(30381): allocator 3.x is not supported [ +1 ms] W/Gralloc3(30381): allocator 3.x is not supported [ +14 ms] W/ACodec (30381): [OMX.Exynos.vp9.dec] getting HDRStaticInfo failed even though codec advertises support [ +4 ms] I/ACodec (30381): [OMX.Exynos.vp9.dec] Now handling output port settings change [ +2 ms] D/SurfaceUtils(30381): set up nativeWindow 0x74cb9d3010 for 640x360, color 0x105, rotation 0, usage 0x402900 [ ] I/ACodec (30381): [OMX.Exynos.vp9.dec] configureOutputBuffersFromNativeWindow setBufferCount : 15, minUndequeuedBuffers : 5 [ +4 ms] D/AudioTrack(30381): setVolume(1.000000, 1.000000) pid : 30381 [ +5 ms] I/ACodec (30381): [OMX.Exynos.vp9.dec] Now Executing [ +15 ms] I/MediaCodec(30381): setCodecState state : 1 [ +184 ms] I/DynamiteModule(30381): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:240304704 [ +2 ms] I/DynamiteModule(30381): Selected remote version of com.google.android.gms.ads.dynamite, version >= 240304704 [ +59 ms] I/System.out(30381): (HTTPLog)-Static: isSBSettingEnabled false [ ] I/System.out(30381): (HTTPLog)-Static: isSBSettingEnabled false [ +52 ms] I/flutter (30381): Instance of 'RewardedAd' loaded. [+1649 ms] I/MediaCodec(30381): setCodecState state : 0 [+2855 ms] D/BufferPoolAccessor2.0(30381): bufferpool2 0x74d0572c28 : 5(40960 size) total buffers - 4(32768 size) used buffers - 1/6 (recycle/alloc) - 5/20 (fetch/transfer) [ ] D/BufferPoolAccessor2.0(30381): evictor expired: 1, evicted: 1 [+17880 ms] I/TRuntime.CctTransportBackend(30381): Making request to: https://firebaselogging-pa.googleapis.com/v1/firelog/legacy/batchlog [ +4 ms] I/System.out(30381): (HTTPLog)-Static: isSBSettingEnabled false [ ] I/System.out(30381): (HTTPLog)-Static: isSBSettingEnabled false [+2301 ms] I/TRuntime.CctTransportBackend(30381): Status Code: 200 [+3530 ms] I/ViewRootImpl@a89624a[MainActivity](30381): ViewPostIme pointer 0 [ +93 ms] I/ViewRootImpl@a89624a[MainActivity](30381): ViewPostIme pointer 1 [ +308 ms] W/Ads (30381): Rewarded ads that show when your app is in the background are a violation of AdMob policies and may lead to blocked ad serving. To learn more, visit https://googlemobileadssdk.page.link/admob-interstitial-policies [ +20 ms] I/flutter (30381): Instance of 'RewardedAd' onAdFailedToShowFullScreenContent: AdError(code: 3, domain: com.google.android.gms.ads, message: The ad can not be shown when app is not in foreground.) [ +4 ms] I/System.out(30381): (HTTPLog)-Static: isSBSettingEnabled false [ ] I/System.out(30381): (HTTPLog)-Static: isSBSettingEnabled false [ +18 ms] I/DynamiteModule(30381): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:240304704 [ ] I/DynamiteModule(30381): Selected remote version of com.google.android.gms.ads.dynamite, version >= 240304704 [ ] V/DynamiteModule(30381): Dynamite loader version >= 2, using loadModule2NoCrashUtils [ +12 ms] I/Ads (30381): Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("B0DE486B6C3CCBD27AD1C80CFF27FD5F")) to get test ads on this device. [ +72 ms] W/ConnectionStatusConfig(30381): Dynamic lookup for intent failed for action: com.google.android.gms.ads.service.START [+1721 ms] I/ExoPlayerImpl(30381): Init 26f09c9 [AndroidXMedia3/1.2.1] [a40, SM-A405FN, samsung, 30] [ +3 ms] I/Ads (30381): ExoPlayerAdapter initialized. [ +334 ms] W/ServiceManager(30381): Permission failure: android.permission.MODIFY_PHONE_STATE from uid=10305 pid=30381 [ ] I/AudioSystem(30381): Permission Denied cuid=10305 param=l_uhq_active_enable [ +6 ms] W/ServiceManager(30381): Permission failure: android.permission.MODIFY_PHONE_STATE from uid=10305 pid=30381 [ ] I/AudioSystem(30381): Permission Denied cuid=10305 param=l_uhq_active_enable [ +13 ms] I/CCodec (30381): state->set(ALLOCATING) [ ] I/CCodec (30381): allocate(c2.android.aac.decoder) [ ] I/CCodec (30381): setting up 'default' as default (vendor) store [ +3 ms] I/CCodec (30381): Created component [c2.android.aac.decoder] [ ] I/CCodec (30381): state->set(ALLOCATED) [ ] D/CCodecConfig(30381): read media type: audio/mp4a-latm [ +6 ms] D/ReflectedParamUpdater(30381): extent() != 1 for single value type: algo.buffers.max-count.values [ ] D/ReflectedParamUpdater(30381): extent() != 1 for single value type: output.subscribed-indices.values [ ] D/ReflectedParamUpdater(30381): extent() != 1 for single value type: input.buffers.allocator-ids.values [ ] D/ReflectedParamUpdater(30381): extent() != 1 for single value type: output.buffers.allocator-ids.values [ ] D/ReflectedParamUpdater(30381): extent() != 1 for single value type: algo.buffers.allocator-ids.values [ ] D/ReflectedParamUpdater(30381): extent() != 1 for single value type: output.buffers.pool-ids.values [ +1 ms] D/ReflectedParamUpdater(30381): extent() != 1 for single value type: algo.buffers.pool-ids.values [ +7 ms] I/CCodecConfig(30381): query failed after returning 19 values (BAD_INDEX) [ +1 ms] D/CCodecConfig(30381): c2 config diff is Dict { [ ] D/CCodecConfig(30381): c2::u32 coded.aac-packaging.value = 0 [ ] D/CCodecConfig(30381): c2::u32 coded.bitrate.value = 64000 [ ] D/CCodecConfig(30381): c2::u32 coded.pl.level = 0 [ ] D/CCodecConfig(30381): c2::u32 coded.pl.profile = 8192 [ ] D/CCodecConfig(30381): c2::i32 coding.drc.album-mode.value = 0 [ ] D/CCodecConfig(30381): c2::float coding.drc.attenuation-factor.value = 1 [ ] D/CCodecConfig(30381): c2::float coding.drc.boost-factor.value = 1 [ ] D/CCodecConfig(30381): c2::i32 coding.drc.compression-mode.value = 3 [ ] D/CCodecConfig(30381): c2::i32 coding.drc.effect-type.value = 3 [ ] D/CCodecConfig(30381): c2::float coding.drc.encoded-level.value = 0.25 [ ] D/CCodecConfig(30381): c2::float coding.drc.reference-level.value = -16 [ ] D/CCodecConfig(30381): c2::u32 input.buffers.max-size.value = 8192 [ ] D/CCodecConfig(30381): c2::u32 input.delay.value = 0 [ ] D/CCodecConfig(30381): string input.media-type.value = "audio/mp4a-latm" [ ] D/CCodecConfig(30381): c2::u32 output.delay.value = 2 [ ] D/CCodecConfig(30381): c2::float output.drc.output-loudness.value = 0.25 [ ] D/CCodecConfig(30381): string output.media-type.value = "audio/raw" [ ] D/CCodecConfig(30381): c2::u32 raw.channel-count.value = 1 [ ] D/CCodecConfig(30381): c2::u32 raw.max-channel-count.value = 8 [ ] D/CCodecConfig(30381): c2::u32 raw.sample-rate.value = 44100 [ ] D/CCodecConfig(30381): } [ +6 ms] D/MediaCodec(30381): flushMediametrics [ ] D/CCodec (30381): [c2.android.aac.decoder] buffers are bound to CCodec for this session [ ] D/CCodec (30381): can't get width [ ] D/CCodec (30381): can't get height [ ] I/CCodec (30381): appPid(30381) width(0) height(0) [ ] D/CCodecConfig(30381): no c2 equivalents for flags [ ] D/CCodecConfig(30381): c2 config diff is c2::u32 raw.channel-count.value = 2 [ ] W/Codec2Client(30381): query -- param skipped: index = 1107298332. [ ] D/CCodec (30381): setup formats input: AMessage(what = 0x00000000) = { [ ] D/CCodec (30381): int32_t aac-drc-album-mode = 0 [ ] D/CCodec (30381): int32_t aac-drc-boost-level = 127 [ ] D/CCodec (30381): int32_t aac-drc-cut-level = 127 [ ] D/CCodec (30381): int32_t aac-drc-effect-type = 3 [ ] D/CCodec (30381): int32_t aac-drc-heavy-compression = 3 [ ] D/CCodec (30381): int32_t aac-encoded-target-level = -1 [ ] D/CCodec (30381): int32_t aac-max-output-channel_count = 8 [ ] D/CCodec (30381): int32_t aac-target-ref-level = 64 [ ] D/CCodec (30381): int32_t channel-count = 2 [ ] D/CCodec (30381): int32_t level = 0 [ ] D/CCodec (30381): int32_t max-input-size = 8192 [ ] D/CCodec (30381): string mime = "audio/mp4a-latm" [ ] D/CCodec (30381): int32_t profile = 2 [ ] D/CCodec (30381): int32_t sample-rate = 44100 [ ] D/CCodec (30381): int64_t durationUs = 0 [ ] D/CCodec (30381): } and output: AMessage(what = 0x00000000) = { [ ] D/CCodec (30381): int32_t aac-drc-album-mode = 0 [ ] D/CCodec (30381): int32_t aac-drc-boost-level = 127 [ ] D/CCodec (30381): int32_t aac-drc-cut-level = 127 [ ] D/CCodec (30381): int32_t aac-drc-effect-type = 3 [ ] D/CCodec (30381): int32_t aac-drc-heavy-compression = 3 [ ] D/CCodec (30381): int32_t aac-drc-output-loudness = -1 [ ] D/CCodec (30381): int32_t aac-encoded-target-level = -1 [ ] D/CCodec (30381): int32_t aac-max-output-channel_count = 8 [ ] D/CCodec (30381): int32_t aac-target-ref-level = 64 [ ] D/CCodec (30381): int32_t channel-count = 2 [ ] D/CCodec (30381): string mime = "audio/raw" [ ] D/CCodec (30381): int32_t sample-rate = 44100 [ ] D/CCodec (30381): } [ ] I/CCodec (30381): state->set(STARTING) [ ] W/Codec2Client(30381): query -- param skipped: index = 1342179345. [ ] W/Codec2Client(30381): query -- param skipped: index = 2415921170. [ ] W/Codec2Client(30381): query -- param skipped: index = 1610614798. [ ] E/FMQ (30381): grantorIdx must be less than 3 [ ] E/FMQ (30381): grantorIdx must be less than 3 [ ] D/BufferPoolAccessor2.0(30381): bufferpool2 0x74d0572c28 : 4(32768 size) total buffers - 4(32768 size) used buffers - 1/6 (recycle/alloc) - 5/20 (fetch/transfer) [ ] D/CCodecBufferChannel(30381): [c2.android.aac.decoder#503] Created input block pool with allocatorID 16 => poolID 18 - OK (0) [ +13 ms] I/CCodecBufferChannel(30381): [c2.android.aac.decoder#503] Created output block pool with allocatorID 16 => poolID 142 - OK [ ] D/CCodecBufferChannel(30381): [c2.android.aac.decoder#503] Configured output block pool ids 142 => OK [ ] I/CCodec (30381): state->set(RUNNING) [ ] I/CCodecBufferChannel(30381): [c2.android.aac.decoder#503] 4 initial input buffers available [ ] E/FMQ (30381): grantorIdx must be less than 3 [ +21 ms] E/FMQ (30381): grantorIdx must be less than 3 [ ] D/CCodecConfig(30381): c2 config diff is c2::i32 coding.drc.compression-mode.value = 1 [ ] D/CCodecBuffers(30381): [c2.android.aac.decoder#503:Output[N]] popFromStashAndRegister: at 1000000000000us, output format changed to AMessage(what = 0x00000000) = { [ ] D/CCodecBuffers(30381): int32_t aac-drc-album-mode = 0 [ ] D/CCodecBuffers(30381): int32_t aac-drc-boost-level = 127 [ ] D/CCodecBuffers(30381): int32_t aac-drc-cut-level = 127 [ ] D/CCodecBuffers(30381): int32_t aac-drc-effect-type = 3 [ ] D/CCodecBuffers(30381): int32_t aac-drc-heavy-compression = 1 [ ] D/CCodecBuffers(30381): int32_t aac-drc-output-loudness = -1 [ ] D/CCodecBuffers(30381): int32_t aac-encoded-target-level = -1 [ ] D/CCodecBuffers(30381): int32_t aac-max-output-channel_count = 8 [ ] D/CCodecBuffers(30381): int32_t aac-target-ref-level = 64 [ ] D/CCodecBuffers(30381): int32_t channel-count = 2 [ ] D/CCodecBuffers(30381): string mime = "audio/raw" [ ] D/CCodecBuffers(30381): int32_t sample-rate = 44100 [ ] D/CCodecBuffers(30381): } [ +5 ms] I/ACodec (30381): [] Now uninitialized [ ] I/ACodec (30381): [] onAllocateComponent [ +1 ms] I/OMXClient(30381): IOmx service obtained [ +4 ms] I/ACodec (30381): [OMX.Exynos.vp9.dec] Now Loaded [ +3 ms] D/MediaCodec(30381): flushMediametrics [ ] D/SurfaceUtils(30381): connecting to surface 0x74cba45010, reason connectToSurface [ ] I/MediaCodec(30381): [OMX.Exynos.vp9.dec] setting surface generation to 31110146 [ ] D/SurfaceUtils(30381): disconnecting from surface 0x74cba45010, reason connectToSurface(reconnect) [ ] D/SurfaceUtils(30381): connecting to surface 0x74cba45010, reason connectToSurface(reconnect) [ +8 ms] I/ACodec (30381): app-pid(30381) [ ] I/ACodec (30381): can't find wfdsink-exynos-enable [ ] W/ACodec (30381): [OMX.Exynos.vp9.dec] setting HDRStaticInfo failed even though codec advertises support [ ] I/ACodec (30381): packageName : com.app.drpciv_examen [ ] I/ACodec (30381): codec does not support config priority (err -1010) [ ] W/ACodec (30381): [OMX.Exynos.vp9.dec] getting HDRStaticInfo failed even though codec advertises support [ +3 ms] I/ACodec (30381): [OMX.Exynos.vp9.dec] Now Loaded->Idle [ +38 ms] D/SurfaceUtils(30381): set up nativeWindow 0x74cba45010 for 640x360, color 0x105, rotation 0, usage 0x402900 [ +2 ms] I/ACodec (30381): [OMX.Exynos.vp9.dec] configureOutputBuffersFromNativeWindow setBufferCount : 9, minUndequeuedBuffers : 5 [ +29 ms] I/ACodec (30381): [OMX.Exynos.vp9.dec] Now Idle->Executing [ ] I/ACodec (30381): [OMX.Exynos.vp9.dec] Now Executing [ ] I/MediaCodec(30381): setCodecState state : 0 [ +12 ms] W/ACodec (30381): [OMX.Exynos.vp9.dec] getting HDRStaticInfo failed even though codec advertises support [ +2 ms] I/ACodec (30381): [OMX.Exynos.vp9.dec] Now handling output port settings change [ +5 ms] D/AudioTrack(30381): setVolume(1.000000, 1.000000) pid : 30381 [ +4 ms] D/SurfaceUtils(30381): set up nativeWindow 0x74cba45010 for 640x360, color 0x105, rotation 0, usage 0x402900 [ +1 ms] I/ACodec (30381): [OMX.Exynos.vp9.dec] configureOutputBuffersFromNativeWindow setBufferCount : 15, minUndequeuedBuffers : 5 [ +19 ms] I/ACodec (30381): [OMX.Exynos.vp9.dec] Now Executing [ +7 ms] I/MediaCodec(30381): setCodecState state : 1 [ +6 ms] I/DynamiteModule(30381): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:240304704 [ ] I/DynamiteModule(30381): Selected remote version of com.google.android.gms.ads.dynamite, version >= 240304704 [ +40 ms] I/System.out(30381): (HTTPLog)-Static: isSBSettingEnabled false [ ] I/System.out(30381): (HTTPLog)-Static: isSBSettingEnabled false [ +26 ms] I/flutter (30381): Instance of 'RewardedAd' loaded. [+1850 ms] I/MediaCodec(30381): setCodecState state : 0 [+2877 ms] D/BufferPoolAccessor2.0(30381): bufferpool2 0x74f4f27c28 : 5(40960 size) total buffers - 4(32768 size) used buffers - 1/6 (recycle/alloc) - 5/18 (fetch/transfer) [ ] D/BufferPoolAccessor2.0(30381): evictor expired: 1, evicted: 1 [+21688 ms] I/p.drpciv_exame(30381): Background concurrent copying GC freed 62675(2981KB) AllocSpace objects, 8(992KB) LOS objects, 49% free, 10232KB/19MB, paused 192us total 139.230ms ``` ``` Analyzing drpciv_examen... warning - Unused import: 'package:drpciv_examen/views/splash_screen.dart' - lib\main.dart:20:8 - unused_import info - Use 'const' with the constructor to improve performance - lib\testing\rewarded_ad.dart:106:16 - prefer_const_constructors info - The imported package 'in_app_purchase_android' isn't a dependency of the importing package - lib\testing\testing.dart:6:8 - depend_on_referenced_packages info - The imported package 'in_app_purchase_android' isn't a dependency of the importing package - lib\testing\testing.dart:7:8 - depend_on_referenced_packages info - The imported package 'in_app_purchase_storekit' isn't a dependency of the importing package - lib\testing\testing.dart:8:8 - depend_on_referenced_packages info - The imported package 'in_app_purchase_storekit' isn't a dependency of the importing package - lib\testing\testing.dart:9:8 - depend_on_referenced_packages info - Don't invoke 'print' in production code - lib\testing\testing.dart:40:7 - avoid_print info - Don't invoke 'print' in production code - lib\testing\testing.dart:235:9 - avoid_print info - Don't invoke 'print' in production code - lib\testing\testing.dart:253:13 - avoid_print info - Don't invoke 'print' in production code - lib\testing\testing.dart:256:13 - avoid_print info - Don't invoke 'print' in production code - lib\testing\testing.dart:261:11 - avoid_print info - Don't use 'BuildContext's across async gaps, guarded by an unrelated 'mounted' check - lib\views\account.dart:433:74 - use_build_context_synchronously info - The imported package 'webview_flutter_android' isn't a dependency of the importing package - lib\views\browser.dart:3:8 - depend_on_referenced_packages info - The imported package 'webview_flutter_wkwebview' isn't a dependency of the importing package - lib\views\browser.dart:4:8 - depend_on_referenced_packages info - An uninitialized field should have an explicit type annotation - lib\views\browser.dart:9:9 - prefer_typing_uninitialized_variables info - The imported package 'in_app_purchase_android' isn't a dependency of the importing package - lib\views\doneaza.dart:4:8 - depend_on_referenced_packages info - The imported package 'webview_flutter_android' isn't a dependency of the importing package - lib\views\examen.dart:12:8 - depend_on_referenced_packages info - The imported package 'webview_flutter_wkwebview' isn't a dependency of the importing package - lib\views\examen.dart:13:8 - depend_on_referenced_packages info - Don't invoke 'print' in production code - lib\views\examen.dart:485:5 - avoid_print info - Don't use 'BuildContext's across async gaps - lib\views\examen.dart:787:29 - use_build_context_synchronously info - Don't use 'BuildContext's across async gaps - lib\views\examen.dart:840:24 - use_build_context_synchronously info - Don't invoke 'print' in production code - lib\views\examen.dart:937:5 - avoid_print warning - The operand can't be null, so the condition is always 'true' - lib\views\greseli.dart:64:19 - unnecessary_null_comparison warning - The operand can't be null, so the condition is always 'true' - lib\views\greseli.dart:163:21 - unnecessary_null_comparison info - Unnecessary override - lib\views\home.dart:1006:8 - unnecessary_overrides info - Unnecessary override - lib\views\login.dart:39:8 - unnecessary_overrides info - The imported package 'in_app_purchase_android' isn't a dependency of the importing package - lib\views\modul.dart:7:8 - depend_on_referenced_packages warning - Unused import: 'package:in_app_purchase_android/billing_client_wrappers.dart' - lib\views\modul.dart:7:8 - unused_import info - The imported package 'in_app_purchase_android' isn't a dependency of the importing package - lib\views\modul.dart:8:8 - depend_on_referenced_packages warning - Unused import: 'package:in_app_purchase_android/in_app_purchase_android.dart' - lib\views\modul.dart:8:8 - unused_import info - The imported package 'in_app_purchase_storekit' isn't a dependency of the importing package - lib\views\modul.dart:9:8 - depend_on_referenced_packages warning - Unused import: 'package:in_app_purchase_storekit/in_app_purchase_storekit.dart' - lib\views\modul.dart:9:8 - unused_import info - The imported package 'in_app_purchase_storekit' isn't a dependency of the importing package - lib\views\modul.dart:10:8 - depend_on_referenced_packages warning - Unused import: 'package:in_app_purchase_storekit/store_kit_wrappers.dart' - lib\views\modul.dart:10:8 - unused_import info - Don't use 'BuildContext's across async gaps - lib\views\modul.dart:630:24 - use_build_context_synchronously info - The imported package 'in_app_purchase_android' isn't a dependency of the importing package - lib\views\remove_ads.dart:5:8 - depend_on_referenced_packages info - Don't invoke 'print' in production code - lib\widgets\bottom_nav_bar.dart:57:19 - avoid_print ``` ``` [√] Flutter (Channel stable, 3.19.3, on Microsoft Windows [Version 10.0.22631.3296], locale en-US) • Flutter version 3.19.3 on channel stable at C:\src\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision ba39319843 (12 days ago), 2024-03-07 15:22:21 -0600 • Engine revision 2e4ba9c6fb • Dart version 3.3.1 • DevTools version 2.31.1 [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at C:\Users\Octav\AppData\Local\Android\Sdk • Platform android-34, build-tools 34.0.0 • ANDROID_HOME = C:\Users\Octav\AppData\Local\Android\Sdk • Java binary at: C:\Program Files\Android\Android Studio3\jbr\bin\java • Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874) • All Android licenses accepted. [√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.2.2) • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community • Visual Studio Community 2022 version 17.2.32519.379 • Windows 10 SDK version 10.0.22000.0 [!] Android Studio (version 2022.3) • Android Studio at C:\Program Files\Android\Android Studio2 • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart X Unable to determine bundled Java version. • Try updating or re-installing Android Studio. [√] Android Studio (version 2023.2) • Android Studio at C:\Program Files\Android\Android Studio3 • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874) [√] VS Code (version 1.87.2) • VS Code at C:\Users\Octav\AppData\Local\Programs\Microsoft VS Code • Flutter extension can be installed from: https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter [√] Connected device (5 available) • SM A405FN (mobile) • R58MC0N1N8B • android-arm64 • Android 11 (API 30) • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 12 (API 32) (emulator) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.3296] • Chrome (web) • chrome • web-javascript • Google Chrome 122.0.6261.129 • Edge (web) • edge • web-javascript • Microsoft Edge 122.0.2365.92 [√] Network resources • All expected network resources are available. ```
malandr2 commented 6 months ago

Hey @tavyDesign, we've seen this issue come up over the years and it has been a challenge to reproduce/troubleshoot.

A few follow-up questions:

Does this error happen consistently for you? if so, can you share a video of the app clearly in the foreground when you get this error?

Does it only happen on a Samsung device? (i.e. not an emulator?)

I tried to reproduce using our reward_example project and was unable to. Requesting more info for for feasible debugging. Thanks!

tavyDesign commented 6 months ago

Hi @malandr2 and thank you, in last two days I had tried a lot of things to fix it. On emulator works as expected, but on real device, lifecycle is not updated when app is resumed. And it doesn't work again until I don't kill the app and open it.

On iOS device and simulator works.

This is code used to load ad, I use a test page, on a new fresh app, it works:

import 'package:flutter/material.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;
  RewardedAd? _rewardedAd;
  final String rewardedAdUnitId = 'ca-app-pub-3940256099942544/5224354917';
  int _numRewardedLoadAttempts = 0;

  void _showRewardedAd() {
    if (_rewardedAd == null) {
      return;
    }
    _rewardedAd!.fullScreenContentCallback = FullScreenContentCallback(
      onAdShowedFullScreenContent: (RewardedAd ad) => debugPrint('ad onAdShowedFullScreenContent.'),
      onAdDismissedFullScreenContent: (RewardedAd ad) {
        debugPrint('$ad onAdDismissedFullScreenContent.');
        ad.dispose();
        _createRewardedAd();
      },
      onAdFailedToShowFullScreenContent: (RewardedAd ad, AdError error) {
        debugPrint('$ad onAdFailedToShowFullScreenContent: $error');
        ad.dispose();
        _createRewardedAd();
      },
    );

    _rewardedAd!.show(onUserEarnedReward: (AdWithoutView ad, RewardItem reward) {
      debugPrint('$ad with reward $RewardItem(${reward.amount}, ${reward.type})');
    });
    _rewardedAd = null;
  }

  void _createRewardedAd() {
    RewardedAd.load(
      adUnitId: rewardedAdUnitId,
      request: const AdRequest(),
      rewardedAdLoadCallback: RewardedAdLoadCallback(
        onAdLoaded: (RewardedAd ad) {
          debugPrint('$ad loaded.');
          _rewardedAd = ad;
          _numRewardedLoadAttempts = 0;
        },
        onAdFailedToLoad: (LoadAdError error) {
          debugPrint('RewardedAd failed to load: $error');
          _rewardedAd = null;
          _numRewardedLoadAttempts++;
          if (_numRewardedLoadAttempts < 3) {
            _createRewardedAd();
          }
        },
      ),
    );
  }

  @override
  void initState() {
    super.initState();
    _createRewardedAd();
  }

  void _incrementCounter() {
    _showRewardedAd();
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text('test'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}

these are my dependencies:

  webview_flutter: ^4.7.0
  http: ^1.2.1
  shared_preferences: ^2.2.2
  url_launcher: ^6.2.5
  cupertino_icons: ^1.0.6
  connectivity_plus: ^5.0.2
  in_app_purchase: ^3.1.13
  google_mobile_ads: ^4.0.0
  firebase_core: ^2.27.1
  firebase_analytics: ^10.8.10
  firebase_core_platform_interface: ^5.0.0
  firebase_crashlytics: ^3.4.19
  app_tracking_transparency: ^2.0.4

android/settings.gradle

  plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version "8.3.0" apply false
    id "org.jetbrains.kotlin.android" version "1.9.23" apply false
    id "com.google.gms.google-services" version "4.4.1" apply false
    id "com.google.firebase.crashlytics" version "2.9.9" apply false
}

android/app/build.gradle

plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
    id "com.google.gms.google-services"
    id "com.google.firebase.crashlytics"
}

kotlinOptions {
        jvmTarget = '1.8'
    }
buildTypes {
        release {
            signingConfig signingConfigs.release
            debuggable false
            shrinkResources true
            zipAlignEnabled true
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

            firebaseCrashlytics {
                // Enable processing and uploading of native symbols to Firebase servers.
                // By default, this is disabled to improve build speeds.
                // This flag must be enabled to see properly-symbolicated native
                // stack traces in the Crashlytics dashboard.
                mappingFileUploadEnabled true
                nativeSymbolUploadEnabled true
                unstrippedNativeLibsDir "build/intermediates/merged_native_libs/release/out/lib/"
                strippedNativeLibsDir "build/intermediates/stripped_native_libs/release/out/lib/"
            }
        }
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            zipAlignEnabled true
            shrinkResources false
        }
dependencies {
    implementation(platform("com.google.firebase:firebase-bom:32.7.4"))
    implementation("com.google.firebase:firebase-crashlytics-ndk")
    implementation("com.google.firebase:firebase-analytics")
    implementation("com.android.support:multidex:2.0.1")
}

Is first time when I open a issue on github and I don't know what information do I need to prove. I Think, maybe some of this affect google_mobile_ads App LifeCycle Status... Please tell me it you need more details. Thanks

malandr2 commented 6 months ago

Hey @tavyDesign are you able to reproduce this consistently on your device? Can you record your screen of the error and what you're observing. A recording would be helpful as other artifacts haven't been the most fruitful to troubleshoot/replicate. Thanks!

tavyDesign commented 6 months ago

Hello, after 100 run and remove codes one by one, I found the code who made this problem on android/app/src/main/AndroidManifest.xml

 <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:exported="true"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize"
            android:showWhenLocked="true"
            android:turnScreenOn="true">

from here these two settings


            android:showWhenLocked="true"
            android:turnScreenOn="true"

Maybe this will help others people to fix this problem.

Screenshot_20240320-012152 Screenshot_20240320-012201 Screenshot_20240320-012207

When phone was locked, on unlock, left button disappeared.

malandr2 commented 6 months ago

@tavyDesign this is a great find. I will share this on the existing thread. Glad to hear you were able to fix your problem.