我有一个已经上市的多活动应用程序,并且通常运行良好。就在最近,我一直在修改代码以以不同的方式处理我的(mopub)广告。当我运行程序并玩多个级别时,这似乎工作正常。广告准确地出现在我想要的时间和地点。问题出现在我退出程序然后尝试重新启动它之后。我的程序的第一个活动是“启动画面”。在第二次运行时,我收到以下错误:
04-23 11:16:50.374: W/dalvikvm(10512): threadid=1: thread exiting with uncaught exception (group=0x40015560)
04-23 11:16:50.394: E/AndroidRuntime(10512): FATAL EXCEPTION: main
04-23 11:16:50.394: E/AndroidRuntime(10512): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mycompany.mygame/com.mycompany.mygame.Splash}: android.view.InflateException: Binary XML file line #24: Error inflating class <unknown>
04-23 11:16:50.394: E/AndroidRuntime(10512): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
04-23 11:16:50.394: E/AndroidRuntime(10512): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
04-23 11:16:50.394: E/AndroidRuntime(10512): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-23 11:16:50.394: E/AndroidRuntime(10512): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
04-23 11:16:50.394: E/AndroidRuntime(10512): at android.os.Handler.dispatchMessage(Handler.java:99)
04-23 11:16:50.394: E/AndroidRuntime(10512): at android.os.Looper.loop(Looper.java:123)
04-23 11:16:50.394: E/AndroidRuntime(10512): at android.app.ActivityThread.main(ActivityThread.java:3683)
知道什么可能导致这种情况 - 为什么它在第一次运行时没有抱怨?
编辑:
这是xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|center_horizontal|center_vertical"
android:background="@drawable/background"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Blah blah blah"
android:textAppearance="?android:attr/textAppearanceMedium" />
<ImageView <<== THIS IS LINE 24
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/mygame_logo" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" My company name"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</LinearLayout>
编辑:回应评论......
我有一个应用程序类定义为:
public class Globals extends Application
{
}
在它的 onCreate 方法中,我有......
allocate_and_initialise_fresh_new_mAdView();
load_mopub_banner_ad();
它们被定义为...
void allocate_and_initialise_fresh_new_mAdView()
{
mAdView = new MoPubView(this);
mAdView.setAdUnitId("agltb3B1Yi1pbmNyDAsSBFNpdGUYkaoMDA");// PUB_ID_320x50
}
void load_mopub_banner_ad()
{
if (mAdView != null)
{
mAdView.loadAd();
}
debug("Completed loadAd");
}