Memory leaks and SDK version issue in v2.9.6
I just started to implement the IMA extension in my application that has a video streaming feature using Exoplayer and everything works fine until a memory leaks appears when closing the app after this implementation even after calling adsLoader.setPlayer(null) in onStop() and adsLoader.relase() in onDestroy(). I am currently using a Single Skippable Inline:
https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dskippablelinear&correlator=
From the documentation page here:
https://developers.google.com/interactive-media-ads/docs/sdks/android/tags
Another thing is it seems like the SDK version is outdated, this is what I saw in a stacktrace whenever I play some video.
Invalid internal message, ignoring. Please make sure the Google IMA SDK library is up to date.
N/A
Here is my full stacktrace.txt
Exoplayer dependency v2.9.6
LG K10 K430dsy Android M 6.0.0
Do you see the memory leak even after imaAdsLoader.release() has been called? (Are you sure onDestroy is getting called?)
Yes onDestroy() is getting called and even after calling imaAdsLoader.release() still the memory leaks kicks in after closing the app. This memory leaks only occurs after implementing IMA Extension.
From the logcat attached, Activity [...] has leaked ServiceConnection com.google.android.gms.common.a@67f33ac that was originally bound here referring to Play Services com.google.android.gms.ads.identifier.AdvertisingIdClient.getAdvertisingIdInfo looks suspicious. Are you able to reproduce this on other devices that have Play Services installed?
Okay I'll try it on another device, btw I update my report with the links regarding Single Skippable Inline.
I am currently using
Android Studio 3.5 Canary 7
Build #AI-183.5429.30.35.5346365, built on March 2, 2019
JRE: 1.8.0_152-release-1343-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 7 6.1
AllCall W1 Android Smartwatch Alps W1 Android L 5.1.1
Still showing Invalid internal message, ignoring. Please make sure the Google IMA SDK library is up to date. but no memory leaks.
Here is the logcat: stacktrace.txt
The Invalid internal message logging is expected in certain situations, and I don't think it indicates a problem here.
This looks like a Play Services issue to me. Is the device up to date in terms of system updates and updates on the Play Store? Were you able to try out any other devices (apart from the smart watch), and if so did you see the memory leak and Activity [...] has leaked ServiceConnection on any of those?
My Google Play Services is in the latest but the device system patch is not, but I do not think it would and should be a problem. Anyway I'll try another device and will immediately post here again.
Cherry Mobile Flare J5s Android Oreo Go Edition
No memory leaks.
stacktrace.txt
I am also detecting a leak, using leak canary. It seems to be the webview present in adsViewGroup that is not released correctly. Like @ArcherEmiya05, I can confirm that imaAdsLoader.setPlayer(null) and imaAdsLoader.release() are correctly called.
I am also using exoplayer 2.9.6 with IMA 3.11.2

@andrewlewis : It seems that the leak occurred only when the adsLoader is release when playing an ad. No leak detected when the content is playing.
I tried to :
Nothing release the WebView properly. Do you know what can I test ?
Hey @ArcherEmiya05. We need more information to resolve this issue but there hasn't been an update in 14 days. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Please disregard the above bot comment. Trying to reproduce this is on my list.
I will test it again with the same device LG K10 K430dsy since memory leaks happens on this device after implementing ads sdk.
There is an issue with the ad overlay view leaking, which I've filed #7344 to track. I think this bug may be the same but it's a bit unclear, and the first part of this issue seems to relate to Play Services. I will close this one for now so please follow #7344 instead, or file a new issue if you are confident you are seeing something different.
Most helpful comment
I am also detecting a leak, using leak canary. It seems to be the webview present in adsViewGroup that is not released correctly. Like @ArcherEmiya05, I can confirm that
imaAdsLoader.setPlayer(null)andimaAdsLoader.release()are correctly called.I am also using exoplayer 2.9.6 with IMA 3.11.2
