我正在尝试将 APPODEAL 横幅广告与我的应用程序集成,但此错误出现在我的 logcat 中:
E/Ads: JS: Uncaught ReferenceError: AFMA_ReceiveMessage is not defined
我尝试这样做:AFMA_ReceiveMessage is not defined但错误信息仍然出现,我看不到任何横幅广告。 我对 build.gradle 的依赖如下所示:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile project(':unity-ads-1.5.3')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
我的横幅显示代码位于我主要 Activity 的 onCreate() 方法中:
new Thread(new Runnable() {
public void run() {
Appodeal.initialize(MainActivity.this, appKey, Appodeal.BANNER);
Appodeal.show(MainActivity.this, Appodeal.BANNER_BOTTOM);
}
}).start();
list 上的权限是这些:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
并且 bundle_id 与 APPODEAL 上的匹配。谁能告诉我发生了什么事或那意味着什么?
--------------------编辑------------------------
我刚刚在这个 google groups discussion 中发现:
(就我而言)这是新创建的广告单元的问题。 创建 24 小时后,它现在运行良好。
最佳答案
检查您是否已将 android:theme="@android:style/Theme.Translucent"
添加到 list 中的 Activity 声明中,如下所示:
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
根据 comments on this question 这似乎已经解决了某人的问题
同时尝试在您的依赖项中包含整个 GMS 库,看看是否可行:
替换:
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
与:
compile 'com.google.android.gms:play-services-ads:8.4.0'
关于android - AFMA_ReceiveMessage 未使用 APPODEAL 定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34597340/