googleads / googleads-mobile-flutter

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

The size of the "documents and data" app is continuously increasing #1068

Closed Francesco-FL closed 2 months ago

Francesco-FL commented 2 months ago

[REQUIRED] Step 1: Describe your environment

Flutter. I reproduced the error on iPhone 15, iOS 17.4.1. On an iPhone 6S iOS 15.8.2 I was unable to reproduce the error, but I was unable to test Meta Audience Network mediation on that device. I haven't tested it on Android at the moment. I tested with both developer options on and off. I tested both an app installed from visual studio code and an app installed via the App Store. I reproduced the error both with my own code and with the example project of your package.

Plugin Version

google_mobile_ads 5.0.0

[REQUIRED] Step 2: Describe the problem

When I install an app that uses GoogleMobileAds, every time it shows an ad it somehow increases the "Documents and data" space occupied by the app. It seems as if the announcement call or the announcements themselves are recorded and saved, considerably increasing the space occupied. For example, after a few minutes of testing with your example project, "App Size" is 19.4 MB, while "Documents and Data" is "16.4 MB". I performed a progressive test on one of my apps, I opened the app for the first time and "Documents and data" was 9.4MB, then I closed it and reopened it and after a few dozen seconds it was at 10.9MB, then 15.9MB, 18.4MB, 19.6MB and it kept increasing every time I used the app. I tried to get the app's "Container" via Xcode, to see who was responsible, and it seems like the main ones are the "AdMob" folder and the "WebKit" folder. I had the same problem with the Meta Audience Network mediation network connected to your plugin. Some time ago I also had a similar problem with AppLovin (mediated by GoogleMobileAds), and I created a bug report on their Github, but they didn't reply to me (I had to stop using it, it took up a lot of space on my phone) (https://github.com/AppLovin/AppLovin-MAX-SDK-iOS/issues/260). Maybe if you verify that what I'm telling you is a bug, you can see if AppLovin's bug depends on you too.

Steps to Reproduce

To reproduce the bug, simply install an app that uses GoogleMobileAds on an iPhone 15, use it by showing some ads, and then look at the space the app takes up. Then you use the app again and repeat the process. You will notice a progressive increase in the space occupied. You can also reproduce it with the example app, but I noticed it more in my apps (maybe because by not using test ad-units and using the "test device" registered on AdMob, I received test ads of different types, while identical ads like those of the template app can perhaps be re-loaded without taking up new space).

Expected results: AdMob and mediation networks should probably clean the cache and not let it accumulate and take up space

Actual results: It seems that caches are not deleted and are instead stored, thus taking up a lot of space on the phone

Logs [✓] Flutter (Channel stable, 3.19.6, on macOS 14.4.1 23E224 darwin-arm64, locale it-IT) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.3) [✓] Chrome - develop for the web [✓] Android Studio (version 2023.2) [✓] VS Code (version 1.88.1) [✓] Connected device (4 available) [✓] Network resources • No issues found!
Screenshot 2024-05-01 alle 16 06 31
Francesco-FL commented 2 months ago

Small update: I noticed that sometimes the increase in space also affects other folders, such as "audience_network" or a folder with the app's package name. It appears these are unremoved caches.

malandr2 commented 2 months ago

Hi @Francesco-FL you can run flutter pub cache clean to resolve the cache.

https://stackoverflow.com/questions/49279379/how-to-clear-flutters-build-cache

Francesco-FL commented 2 months ago

Hi @malandr2 Perhaps there was a misunderstanding, the increase in space is found inside the phone, from release version apps that contain ads.

I'm not referring to the increase in space on my computer.

The image I put before is made by analyzing the "Documents and data" folder of the app contained in the phone (Xcode => Devices and simulators => Installed apps => Download container)

I attach an image that perhaps better explains the problem of increasing space on the phone (the apps in question are not in debug, they are created and installed as release versions, and the ads occupy the space of the phone, progressively increasing it):

IMG_2884 IMG_2883

malandr2 commented 2 months ago

Hi @Francesco-FL, I can replicate the documents & data increasing with our iOS AdManagerBannerExample. It's not because the ads occupy space on the phone but rather our iOS SDK utilizes local storage to store information such as privacy information (as well as other information) for an optimized user experience. This is not something the Flutter team can address but if you would like you can open a thread in the AdMob Developers forum.

malandr2 commented 2 months ago

I recommend also testing Android

Francesco-FL commented 2 months ago

Got it, thanks for the info. I leave the link below for those who want to follow the issue. https://groups.google.com/g/google-admob-ads-sdk/c/H6ZvwzHmqKQ

Francesco-FL commented 2 months ago

Hi @malandr2, sorry if I'm calling you again about a closed issue but the forum employee keeps telling me that he can't replicate the error, while you managed to do it easily. Could you write him a message to send him in the right direction?

malandr2 commented 1 month ago

Hi @Francesco-FL, I've followed up to help assist with restarting the debugging process