gpt4 book ai didi

android - 集成 AdMob 时出现资源未找到异常

转载 作者:行者123 更新时间:2023-11-30 03:40:55 25 4
gpt4 key购买 nike

安卓 2.3.3

我已按照步骤操作,在 this 中找到教程。当我在我的设备(移动设备)中运行该应用程序时,广告正在显示。没问题。但是当我尝试在我的 eclipse 中查看 Activity 时,我得到一个带有 NullPointerException 的空白屏幕。我已经截图了。请引用。

enter image description here

然后,我单击了异常“详细信息”(SourceFile:670) 中给出的链接,我得到了以下详细信息..

enter image description here

我单击了“添加源”,并浏览到我的应用程序->libs 文件夹中的 jar 文件。然后我得到以下...

enter image description here

这是我使用过的 xml 和 java 代码...

XML

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="140dp"
android:background="#000000"
android:orientation="vertical" >

<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="a151xxxxxxxxx"
ads:adSize="BANNER"
ads:loadAdOnCreate="true"/>



<TextView
android:id="@+id/txtViewPrevious"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:gravity="right"
android:height="25dp"
android:singleLine="true"
android:text=""
android:textSize="16sp" />

.....
.....

Java

private AdView adView;
adView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest();
adView.loadAd(adRequest);

图书馆

enter image description here

我如何摆脱这些异常?

提前致谢...

最佳答案

这会发生。这是正常的。 Eclipse 有时无法显示自定义 View (实际上大部分时间)。

关于android - 集成 AdMob 时出现资源未找到异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15778550/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com