我正在研究如何将 MoPub 的 Android 和 iOS 原生广告实现集成到 Flutter。为了让 Flutter 正确显示,需要传递从 MoPub 接收到的原生广告的哪些数据在下面的onNativeLoad方法中?
基于 MoPub 的手动原生广告集成文档(在 Android 上),可以通过EventChannel接收和传递广告数据,以便在 Flutter 的 UI 中显示。我不确定NativeAd需要将对象中的哪些信息传递给 Flutter。
moPubNativeNetworkListener = new MoPubNative.MoPubNativeNetworkListener() {
@Override
public void onNativeLoad(final NativeAd nativeAd) {
Log.d("MoPub", "Native ad has loaded.");
}
@Override
public void onNativeFail(NativeErrorCode errorCode) {
Log.d("MoPub", "Native ad failed to load with error: " + errorCode.toString());
}
};
Run Code Online (Sandbox Code Playgroud)
开发人员在 Flutter 上使用 MoPub 将是关键,因为它允许访问主要广告网络,从而提供有效的货币化。
我正在尝试使用适用于 iOS 14 的 MoPub 通过我的应用程序获利,但我的广告未显示,并且在尝试显示广告时我在日志中收到以下消息:
Initialized OM SDK version: 1.3.4-Mopub
Attempting to load ad
[assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}>
[ProcessSuspension] 0x10b0b8bc0 - ProcessAssertion: Failed to acquire RBS Background assertion 'WebProcess Background Assertion' for process with PID 18829, error: Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" …Run Code Online (Sandbox Code Playgroud) 所以我今天决定拆分我的项目(用于精简/完整版本).我将主代码打包到库项目中,添加了两个新的shell项目,并将它们链接在一起.所有这些都运行良好,我可以运行精简版或完整版,没有问题.
但是,我在库项目中遇到Mopub集成问题.我按照他们的小教程,非常简单.我的问题是项目中包的构建顺序.由于安装过程(图示一部分在这里),它创建了一个com.mopub.mobileads在我的项目包.
这是我第一次在项目中遇到多个包的问题,但出于某种原因,Eclispe坚持我的导入:
import com.mopub.mobileads.MoPubView;
Run Code Online (Sandbox Code Playgroud)
无法解决,特别是com.mopub部分.
我唯一的猜测是,当我编译时,它首先尝试编译我的包,而它还没有看到Mopub包.但是,如果是这种情况,我不能为我的生活弄清楚如何更改单个包的构建顺序.如果我想改变项目的顺序,我会被设置,因为这很简单.谷歌对此也没有多大帮助.
我知道我可以将源文件添加到我自己的包中,修复它们的导入以匹配,并解决整个问题,但这是一个丑陋的黑客,我宁愿避免.
我知道我只是错过了一些愚蠢的东西,但我只是没有看到它.
它给出的错误指向导入行,以及引用MoPubView的每一行,这正是您所期望的:
(error x 5)MoPubView cannot be resolved to a type mainAct.java
R.id.adView cannot be resolved mainAct.java
The import com.mopub cannot be resolved mainAct.java
Run Code Online (Sandbox Code Playgroud) 解决方案:因此Mopub的说明没有提到EventKit并且EventKitUI是必需的.除了MoPub提到的框架之外,还添加了这些项目.
更新: MoPub的说明已更新.
我按照他们的指示将MoPub的完整iOS SDK集成到我的应用程序中.不幸的是,在添加代码和所需的框架后,我得到以下构建错误:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_EKAlarm", referenced from:
objc-class-ref in MRCalendarManager.o
"_OBJC_CLASS_$_EKEvent", referenced from:
objc-class-ref in MRCalendarManager.o
"_OBJC_CLASS_$_EKEventEditViewController", referenced from:
objc-class-ref in MPInstanceProvider.o
"_OBJC_CLASS_$_EKEventStore", referenced from:
objc-class-ref in MPInstanceProvider.o
objc-class-ref in MRProperty.o
"_OBJC_CLASS_$_EKRecurrenceDayOfWeek", referenced from:
objc-class-ref in MRCalendarManager.o
"_OBJC_CLASS_$_EKRecurrenceEnd", referenced from:
objc-class-ref in MRCalendarManager.o
"_OBJC_CLASS_$_EKRecurrenceRule", referenced from:
objc-class-ref in MRCalendarManager.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v …Run Code Online (Sandbox Code Playgroud) 我已经坚持了一段时间的问题,我无法弄清楚它是什么.问题是我最近更新了Mopub Android SDK,并且插页式+横幅广告(AdMob和Millennial Media)在此之前工作正常.现在这些广告在发布版本中不起作用,但它们在调试版本中起作用.所以我认为这是一个问题,proguard但我无法追查它是什么.在proguard根据是建立Mopub准则.
我proguard为我的项目添加了以下内容:
-keep class com.google.ads.**
-keep class com.millennialmedia.android.**
-keep public class com.mopub.mobileads.*
-keepclassmembers class com.millennialmedia.android.* {
public *;
}
Run Code Online (Sandbox Code Playgroud)
在发布版本中,当我尝试显示广告时,我会收到以下日志:
I/MoPub (29856): Fetching ad network type: admob_native
D/MoPub (29856): Loading custom event interstitial adapter.
D/MoPub (29856): Attempting to invoke custom event: com.mopub.mobileads.GoogleAdMobInterstitial
D/MoPub (29856): Couldn't locate or instantiate custom event: com.mopub.mobileads.GoogleAdMobInterstitial.
I/MoPub (29856): Fetching ad network type: admob_native
D/MoPub (29856): Loading custom event …Run Code Online (Sandbox Code Playgroud) 我正在使用该链接通过mopub添加Google Play Servcies(admob)广告
https://github.com/mopub/mopub-android-sdk/wiki/Integrating-with-Google-Play-Services
我按照所有步骤操作,但是当我运行代码时它显示错误无法找到或实例化自定义事件:com.mopub.mobileads.GoogleAdMobBanner
阅读题目后http://help.mopub.com/customer/portal/articles/785346-issues-with-admob-proguard 我增加了以下线在我的项目和SDK项目proguard.cfg的proguard的-project.txt文件文件,但问题仍未解决.请帮忙.
-keep class com.google.android.gms.common.GooglePlayServicesUtil {*;}
# AdMob Support
-keep class com.google.ads.**
-keepclassmembers class com.mopub.mobileads.* { public *; }
-keep public class com.mopub.mobileads.*
Run Code Online (Sandbox Code Playgroud) 我需要在底部屏幕的宽度上划出/填充我的横幅广告.
我的代码适用于宽度等于MOPUB_BANNER_SIZE.width或MOPUB_LEADERBOARD_SIZE.width的 设备.但在其他设备(iPhone 5/6 /等和一些iPad)上我唯一的选择是将横幅居中.这是代码:
if(!_mopubBanner){
NSString* bannerID;
const CGSize* bannerSize;
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){
bannerID = @"MopubBannerId";
bannerSize = &MOPUB_BANNER_SIZE;
}
else{
bannerID = @"MopubLeaderboardId";
bannerSize = &MOPUB_LEADERBOARD_SIZE;
}
_mopubBanner = [[MPAdView alloc] initWithAdUnitId:bannerID size:*bannerSize];
_mopubBanner.delegate = self;
CGRect BannerFrameRect;
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
BannerFrameRect = CGRectMake(([[UIScreen mainScreen] bounds].size.width - MOPUB_BANNER_SIZE.width) / 2,
[[UIScreen mainScreen] bounds].size.height - MOPUB_BANNER_SIZE.height,
MOPUB_BANNER_SIZE.width,
MOPUB_BANNER_SIZE.height);
}
else
{
BannerFrameRect = CGRectMake(([[UIScreen mainScreen] bounds].size.width - MOPUB_LEADERBOARD_SIZE.width) / 2,
[[UIScreen mainScreen] bounds].size.height - MOPUB_LEADERBOARD_SIZE.height, …Run Code Online (Sandbox Code Playgroud) 我在我的项目中使用 firebase 适配器,现在正在集成 admob 以获得奖励广告,它工作正常,但是每个视频完成后都会抛出以下错误...
java.lang.ClassCastException: com.google.ads.mediation.admob.AdMobAdapter cannot be cast to com.google.android.gms.ads.mediation.m
at com.google.android.gms.ads.internal.mediation.client.y.a(:com.google.android.gms.dynamite_dynamitemodulesa@12685008@12.6.85 (020306-197041431):262)
at com.google.android.gms.ads.internal.reward.c.b(:com.google.android.gms.dynamite_dynamitemodulesa@12685008@12.6.85 (020306-197041431):54)
at com.google.android.gms.ads.internal.reward.client.e.onTransact(:com.google.android.gms.dynamite_dynamitemodulesa@12685008@12.6.85 (020306-197041431):56)
at android.os.Binder.transact(Binder.java:380)
at com.google.android.gms.internal.ads.zzej.transactAndReadExceptionReturnVoid(Unknown Source)
at com.google.android.gms.internal.ads.zzahb.zze(Unknown Source)
at com.google.android.gms.internal.ads.zzahm.resume(Unknown Source)
at com.mopub.mobileads.GooglePlayServicesRewardedVideo$1.onResume(GooglePlayServicesRewardedVideo.java:84)
at com.mopub.common.MoPubLifecycleManager.onResume(MoPubLifecycleManager.java:83)
at com.mopub.common.MoPub.onResume(MoPub.java:257)
at com.coderays.realquiz.RealQuizDashBoard.onResume(RealQuizDashBoard.java:956)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1280)
at android.app.Activity.performResume(Activity.java:6096)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3011)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3063)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1361)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
Run Code Online (Sandbox Code Playgroud)
我会尝试这个方法/sf/answers/3497166571/但仍然抛出这个错误。
我的等级是..
dependencies {
implementation('com.mopub:mopub-sdk-interstitial:5.0.0@aar') {
transitive = true
}
// For rewarded …Run Code Online (Sandbox Code Playgroud) android admob mopub mobile-ad-mediation admob-rewardedvideoad
我正在尝试显示来自 mopub 的原生广告。测试广告显示正常。但是一旦它转向显示真正的原生广告,它就会失败并显示以下错误“广告服务器没有返回库存”。未解释此错误,或者我找不到有关此错误的任何文档。我正在使用最新的 iOS SDK。
请帮助解决此错误。
提前致谢。
我\xe2\x80\x99m 尝试在MoPub 上执行横幅和全屏广告,但我\xe2\x80\x99m 收到这两个错误。
\n\n谢谢。
\n\n错误 1:广告单元禁用刷新(此处为单元 ID)
\n\n错误 2:Activityname 泄露了最初在此处注册的 IntentReceiver com.mopub.mobileads.MoPubView$1@a72e13a。您是否错过了对 unregisterReceiver() 的调用?
\n\nI\xe2\x80\x99m 像这样执行它。
\n\nmInterstitial_recent = new MoPubInterstitial(MainActivity.this, getString(R.string.Recent_Matches_Interstitial));\nmInterstitial_recent.load();\nmInterstitial_recent.setInterstitialAdListener(new MoPubInterstitial.InterstitialAdListener() {\n @Override\n public void onInterstitialLoaded(MoPubInterstitial interstitial) {\n if (mInterstitial_recent.isReady()) {\n mInterstitial_recent.show();\n }\n }\n\n @Override\n public void onInterstitialFailed(MoPubInterstitial interstitial, MoPubErrorCode errorCode) {\n startActivity(new Intent(MainActivity.this, Recent_Matches.class));\n }\n\n @Override\n public void onInterstitialShown(MoPubInterstitial interstitial) {\n\n }\n\n @Override\n public void onInterstitialClicked(MoPubInterstitial interstitial) {\n\n }\n\n @Override\n public void onInterstitialDismissed(MoPubInterstitial interstitial) {\n startActivity(new Intent(MainActivity.this, Recent_Matches.class));\n }\n});\nRun Code Online (Sandbox Code Playgroud)\n