问题描述
清单文件
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
活动类有这个 -
Activity class has this -
AdView adView = new AdView(this, AdSize.BANNER, "xxxxxxxxxxx");
// Lookup your LinearLayout assuming it’s been given
// the attribute android:id="@+id/mainLayout"
LinearLayout layout = (LinearLayout)findViewById(R.id.linearLayout02);
// Add the adView to it
layout.addView(adView);
// Initiate a generic request to load it with an ad
adView.loadAd(new AdRequest());
new AdRequest().addTestDevice("CD9E4FDFA47A4AA03F9883E77C036EB3");
运行后,我得到这个 -
After running I get this -
05-17 22:39:11.153: INFO/Ads(7831): adRequestUrlHtml: <html><head><script src="http://www.gstatic.com/afma/sdk-core-v40.js"></script><script>AFMA_buildAdURL({"msid":"com.cob.fivethings","hl":"en","preqs":0,"u_so":"p","slotname":"a14dd24e71c7a34","js":"afma-sdk-a-v4.1.0","app_name":"1.android.com.cob.fivethings","isu":"CD9E4FDFA47A4AA03F9883E77C036EB3","u_audio":3,"u_w":320,"format":"320x50_mb","u_sd":1,"net":"ed","u_h":480});</script></head><body></body></html>
05-17 22:39:13.138: INFO/Ads(7831): Received ad url: <"url": "http://r.admob.com:80/ad_source.php?msid=com.cob.fivethings&hl=en&preqs=0&u_so=p&slotname=a14dd24e71c7a34&js=afma-sdk-a-v4.1.0&app_name=1.android.com.cob.fivethings&isu=CD9E4FDFA47A4AA03F9883E77C036EB3&u_audio=3&u_w=320&format=320x50_mb&u_sd=1&net=ed&u_h=480&output=html®ion=mobile_app&u_tz=-60&ex=1&client_sdk=1", "afmaNotifyDt": "null">
05-17 22:39:27.058: INFO/ActivityManager(1848): Stopping service: com.android.mms/.transaction.TransactionService
05-17 22:40:11.163: INFO/Ads(7831): AdLoader timed out after 60000ms while getting the HTML.
05-17 22:40:11.193: INFO/Ads(7831): onFailedToReceiveAd(A network error occurred.)
05-17 22:43:07.343: INFO/ActivityManager(1848): Stopping service: com.android.mms/.transaction.TransactionService
这是怎么了?
What is going wrong?
推荐答案
我的Android游戏发布在谷歌的市场上,但我没有得到任何IM pressions AdMob提供的。有没有在code无显著的变化,或者所有的感动AdMob的来源和我的比赛的previous版本中正常工作,甚至改变。
My Android game was published on the Google's market, but I didn't get any impressions from AdMob. There was no significant changes in the code, or even changes at all that touched AdMob sources and the previous versions of my game were working properly.
由于原来的问题过程中的ProGuard进行模糊处理过程升高。如果你使用它做Java的标志是混淆从proguard.cfg摆脱 -optimize
指令,并把 -dontoptimize
代替。
As it turned out the problem was elevated during obfuscation process done by proguard. If you're using it to do the mangling of Java's symbols get rid of the -optimize
directive from your proguard.cfg and put -dontoptimize
instead.
这篇关于AdMob的不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!