-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Ads] Java exceptions are thrown when calling AdParam.Builder class methods #262
Comments
Hello there. I will be looking into it and I'll get back to you 👍 |
Hello there @MantasKriksciunas This is the code sample that I modified in HMSAdsKitManager.cs file. private void Init()
{
HwAds.Init();
isInitialized = true;
adsKitSettings = HMSAdsKitSettings.Instance.Settings;
Debug.LogWarning("Start");
RequestOptions _options = HwAds.RequestOptions;
_options = _options.ToBuilder()
.SetTagForChildProtection(TagForChild.TAG_FOR_CHILD_PROTECTION_FALSE)
.SetTagForUnderAgeOfPromise(UnderAge.PROMISE_FALSE)
.SetNonPersonalizedAd(NonPersonalizedAd.ALLOW_ALL)
.Build();
Debug.LogWarning("End");
} And this is the resulting screenshot of the logs. Do you have proguard or something active on the Android side that is stripping some codes by any chance? |
Sorry, it seems that I referenced the wrong class here. After retesting, like you said, this code passes without issues. Exceptions are related not to private void Init()
{
HwAds.Init();
isInitialized = true;
adsKitSettings = HMSAdsKitSettings.Instance.Settings;
Debug.LogWarning("Start");
AdParam.Builder _builder = new AdParam.Builder();
AdParam _ad_param;
_ad_param = _builder
.SetTagForChildProtection(TagForChild.TAG_FOR_CHILD_PROTECTION_FALSE)
.SetTagForUnderAgeOfPromise(UnderAge.PROMISE_FALSE)
.SetNonPersonalizedAd(NonPersonalizedAd.ALLOW_ALL)
.Build();
Debug.LogWarning("End");
} Also, I don't have any stripping active or proguard files in the project. I've tested this on a fresh project with the only change being the min SDK version, that's set to 21 instead of the default 19. |
Hello there @MantasKriksciunas |
Hello, I'm glad to hear that you've found the problem. Thank you very much! |
This issue should be resolved in the v2.1.1 release. |
Hello, |
Hi,
I'm having trouble with some of HuaweiMobileServices.Ads namespace classes. There seems to be an
java.lang.NoSuchMethodError
exception thrown at runtime when I execute the following code:It seems to happen with every
Builder
classSet*
function. I've tried updating libraries with the latest version frommaster
and clearing the project's cache but it didn't help to solve this.Perhaps I'm missing something? I could only find these old issues (EvilMindDevs/hms-sdk-unity#46, #56) for reference
Here are the logs: logcat.txt
Setup
Huawei device setup:
Unity setup:
v2.1.0 - Unity 2019/2020/2021
plugin packageMono
Scripting BackendHuawei gradle implementations:
The text was updated successfully, but these errors were encountered: