Android 将权限添加到我的清单后,不会显示AdMob广告
我测试了应用程序是否应该添加有一个框,上面写着“将活动添加到我的清单中”,一旦我添加了“现在没有任何内容”,该框就被删除了。以下是我在我的应用程序中输入的所有代码,我意识到一些代码现在是无用的,因为我尝试了所有不同的东西。我的应用程序中包含了不必要的代码,如果你看到一些我可以删除的代码,请让我也知道 主要问题:为什么广告没有出现 爪哇 主布局Android 将权限添加到我的清单后,不会显示AdMob广告,android,admob,Android,Admob,我测试了应用程序是否应该添加有一个框,上面写着“将活动添加到我的清单中”,一旦我添加了“现在没有任何内容”,该框就被删除了。以下是我在我的应用程序中输入的所有代码,我意识到一些代码现在是无用的,因为我尝试了所有不同的东西。我的应用程序中包含了不必要的代码,如果你看到一些我可以删除的代码,请让我也知道 主要问题:为什么广告没有出现 爪哇 主布局 xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" xmlns:tool
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/android_drinking"
tools:context=".PlayerInput" >
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
ads:adUnitId="a14ff402be4457c"
ads:adSize="BANNER"
ads:testDevices="TEST_EMULATOR"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
ads:loadAdOnCreate="true"/>
xmlns:ads=”http://schemas.android.com/apk/lib/com.google.ads"
xmlns:tools=”http://schemas.android.com/tools"
android:layout\u width=“fill\u parent”
android:layout\u height=“fill\u parent”
android:background=“@drawable/android\u”
工具:context=“.PlayerInput”>
属性xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="com.admob.android.ads.AdView">
<attr name="backgroundColor" format="color" />
<attr name="primaryTextColor" format="color" />
<attr name="secondaryTextColor" format="color" />
<attr name="keywords" format="string" />
<attr name="refreshInterval" format="integer" />
</declare-styleable>
</resources>
我今晚要尝试的功能。我通过电子邮件将应用程序添加到我妻子的平板电脑上,它们必须正常工作。我必须将其设置为测试错误,我也从应用程序中删除了java部分。下面是一个简单的教程,包含所有需要的信息
)
开发此应用程序时请记住
你需要谷歌广告发布者ID
您需要在类路径中添加Google AdMob Ads SDK.jar文件
您必须将应用程序目标设置为API 13或更新版本
另外,不要忘记添加internet权限
您需要以这种方式在应用程序标记的清单文件中添加Google广告活动
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
</application>
希望它能帮助你 如果您正确地向admob发出请求,请检查LogCat
有时,唯一的问题是请求失败,因为admob库存不足
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<meta-data android:value="YOUR_ID_HERE" android:name="ADMOB_PUBLISHER_ID" />
<!-- AdMobActivity definition -->
<activity android:name="com.admob.android.ads.AdMobActivity"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:configChanges="orientation|keyboard|keyboardHidden" />
<!-- Track Market installs -->
<receiver android:name="com.admob.android.ads.analytics.InstallReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
</application>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
</manifest>
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
</application>