Android 带有AdMob和Google Play Services库的广告不会显示在设备上
我对AdMob和Google Play服务有一个问题,这让我疯狂了好几天。感觉这几乎不可能实现。这种实现有什么问题 layout.xml以下代码位于布局的底部:Android 带有AdMob和Google Play Services库的广告不会显示在设备上,android,android-emulator,admob,device,Android,Android Emulator,Admob,Device,我对AdMob和Google Play服务有一个问题,这让我疯狂了好几天。感觉这几乎不可能实现。这种实现有什么问题 layout.xml以下代码位于布局的底部: xmlns:ads="http://schemas.android.com/apk/res-auto" ... <LinearLayout android:id="@+id/layoutAd" android:layout_width="match_parent" andro
xmlns:ads="http://schemas.android.com/apk/res-auto"
...
<LinearLayout
android:id="@+id/layoutAd"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_marginTop="5dp"
android:layout_weight="3"
android:orientation="vertical" >
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="@string/ad_unit_id" />
</LinearLayout>
AndroidManifest.xml:
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
...
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
广告永远不会出现,但如果我在模拟器上运行它,它就会出现
我错了什么?试着读一读,然后 尝试使用:
import com.google.android.gms.ads.*;
而不是:
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.AdSize;
这为我解决了一些问题。我的建议是对代码进行注释 添加测试设备9234ebae83e894e6271debe7b380782e.build 并连接您的手机,确保电脑检测到您的手机 并运行项目时,您的设备应显示在选择要运行的设备上 单击“确定” 希望这有帮助 最后一个建议是,如果您使用Eclipse,请在顶部菜单中单击“转到项目” 很多时候,这会清除工作区中的垃圾数据这是相同的问题:。。。。也许,这会有帮助!
import com.google.android.gms.ads.*;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.AdSize;