I am using a unity mediation for my app. I am trying to initialize it with this code
UnityMediation.initialize(
gameId: GetPlatform.isAndroid ? '4865xxx' : '4865xxx',
onComplete: () => print('Initialization Complete'),
onFailed: (error, message) => print('Initialization Failed: $error $message'),
);
UnityMediation.loadRewardedAd(
adUnitId: GetPlatform.isAndroid ? 'Rewarded_Android' : 'Rewarded_iOS',
onComplete: (adUnitId) => print('Rewarded Ad Load Complete $adUnitId'),
onFailed: (adUnitId, error, message) => print('Rewarded Ad Load Failed $adUnitId: $error $message'),
);
Following all the documentation provided but get an error like this one
[VERBOSE-2:ui_dart_state.cc(198)] Unhandled Exception: MissingPluginException(No implementation found for method init on channel com.rebeloid.unity_mediation)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:165:7)
<asynchronous suspension>
#1 UnityMediation.initialize (package:unity_mediation/src/unity_mediation.dart:26:5)
<asynchronous suspension>
[VERBOSE-2:ui_dart_state.cc(198)] Unhandled Exception: MissingPluginException(No implementation found for method loadRewardedAd on channel com.rebeloid.unity_mediation)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:165:7)
<asynchronous suspension>
#1 UnityMediation._loadAd (package:unity_mediation/src/unity_mediation.dart:115:5)
<asynchronous suspension>
#2 UnityMediation.loadRewardedAd (package:unity_mediation/src/unity_mediation.dart:75:5)
<asynchronous suspension>
Plugin used https://pub.dev/packages/unity_mediation
What is the cause of this problem? I have trying to search but nothing found about this one. Thank you.
CodePudding user response:
Quit the app and run it again. The native code from the package isn't on the device until do a full start. Hot reload and hot restart won't work after using a newly installed package.