how to solve ”JS: Not allowed to load local resource: file” problem?

1,283 views
Skip to first unread message

ssoli...@gmail.com

unread,
Jul 5, 2014, 7:42:33 AM7/5/14
to google-adm...@googlegroups.com

hi,

I  followed this tutorial (http://discuss.cocos2d-x.org/t/cocos3-0-tutorial-integrate-admob-google-play-services-with-cocos2d-x-v3-0-final/12798)
to add admob into my app.

I can compile the code and run it, but I can't get ad show up .

From logcat I got these messages:

07-05 18:59:17.319: I/Ads(17472): Starting ad request.
07-05 18:59:17.329: I/Ads(17472): Please set theme of AdActivity to @android:style/Theme.Translucent to enable transparent background interstitial ad.
07-05 18:59:18.080: E/Ads(14474): JS: Uncaught ReferenceError: AFMA_buildAdURL is not defined (:1)
07-05 18:59:18.080: E/Ads(14474): JS: Not allowed to load local resource: file:///android_asset/webkit/android-weberror.png (data:text/html,chromewebdata:12)
07-05 19:00:17.733: W/Ads(17472): Timed out waiting for ad response.
07-05 19:00:17.733: I/Ads(17472): Scheduling ad refresh 60000 milliseconds from now.
07-05 19:00:17.733: W/Ads(17472): Failed to load ad: 2


I have google these messages, but can't get an solution.

Have someone met this problem before and can you please show me how  to solve it?

Thank you very much!

Best Regards.
ssolid2014

Eric Leichtenschlag

unread,
Jul 9, 2014, 8:46:11 PM7/9/14
to google-adm...@googlegroups.com
I haven't seen "not allowed to load local resource" before, but "Uncaught ReferenceError: AFMA_buildAdURL is not defined" can happen if AdMob can't load a JS file that has the AFMA_buildAdURL method in it. This issue is intermittent though, hopefully it'll work if you try again.

Thanks,
Eric 

William Ferguson

unread,
Jul 10, 2014, 3:35:58 AM7/10/14
to google-adm...@googlegroups.com
The Android team is phasing out any access to file based resources. I believe this is being enforced more strongly in L.
So any "file://" URLs are likely to fail going forward.

William

ssoli...@gmail.com

unread,
Jul 10, 2014, 12:52:39 PM7/10/14
to google-adm...@googlegroups.com
Thank you for you reply.

I have install my app on another android phone, and this time it works.
Ads show normally on the second phone.

But the first device I tried on is nexus 4 with android 4.4, I think this the standard environment for android app, but why it can't work on nexus 4 ?




在 2014年7月10日星期四UTC+8上午8时46分11秒,Eric Leichtenschlag写道:
Reply all
Reply to author
Forward
0 new messages