AdRequest "This method should only be accessed from tests or within private scope"
Asked Answered
K

3

12

I have seen that recently a new warning has appeared in mi project in the following line:

    AdRequest adRequest = new AdRequest.Builder().build();

The warning is in "new AdRequest.Builder().build();"

This is the warning:

This method should only be accessed from tests or within private scope

I don't understand why this warning is showing, could it be a bug or something like that?

Knob answered 22/1, 2023 at 23:50 Comment(1)
Did you find the solution finally?Convoke
D
3

This warning disappeared after updating to version 21.5.0 of the Google Ads SDK.

implementation 'com.google.android.gms:play-services-ads:21.5.0'
Darsey answered 23/2, 2023 at 11:17 Comment(1)
Still getting it in 22.1.0Doura
T
0

I have the same issue, and added

@SuppressLint("VisibleForTests")
AdRequest adRequest = new AdRequest.Builder().build();

It is NOT a good solution, but it made the warning go away and the adds seem to work.

Taejon answered 1/2, 2023 at 20:55 Comment(0)
N
0

I get this message in the line:

if(ArrayUtils.contains(...)){...}

for the term 'contains'.

@McFarlane: I have not implemented 'play-services-ads:21.5.0', but 'play-services-location:21.0.1' instead.

Noshow answered 13/12, 2023 at 10:38 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.