Xamarin.Android应用程序第二次没有启动

时间:2013-05-07 13:03:29

标签: android xamarin.android xamarin

我用Xamarin试用版创建了一个简单的应用程序,它只显示了一个闪屏。在Xamarin工作室点击“Run”后,它部署并运行得很好,但是如果我点击设备上的“Home”并尝试从应用程序列表中运行应用程序 - 屏幕闪烁片刻并且应用程序被终止,没有断点被击中在第二轮。对于仿真器和物理设备都是如此。

我怀疑这很重要,但我的代码如下。

布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:minWidth="25px"
    android:minHeight="25px">
    <ImageView
        android:src="@drawable/splash"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/imageView1" />
</LinearLayout>

的活动:

using Android.App;
using Android.OS;
using System;
using Android.Views;

namespace MyApplication.Activities
{
    [Activity(Label = "My application", MainLauncher = true)]
    public class SplashActivity : Activity
    {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            RequestWindowFeature(WindowFeatures.NoTitle);
            SetContentView(Resource.Layout.Splash);
        }
    }
}

问题是否发生是因为它是Xamarin的试用版?

1 个答案:

答案 0 :(得分:0)

好吧,看起来试用版确实会导致我的问题。 Adb logcat有一行:

I/ActivityManager(  308): Displayed MyApplication/MyApplication.Activities.SplashActivity: +845ms
D/Finsky  (  759): [1] 5.onFinished: Installation state replication succeeded.
I/ActivityManager(  308): START {act=android.intent.action.MAIN cat=[android.int
ent.category.LAUNCHER] flg=0x10200000 cmp=MyApplication/MyApplication.TrialSplashS
creenf2b499ae00e24b5ba2aa0253572b8e1e u=0} from pid 518
D/dalvikvm(  308): GC_FOR_ALLOC freed 1293K, 15% free 18885K/22023K, paused 66ms
, total 67ms
D/dalvikvm( 7162): Late-enabling CheckJNI
I/ActivityManager(  308): Start proc MyApplication for activity MyApplication/MyApplication.TrialSplashScreenf2b499ae00e24b5ba2aa0253572b8e1e: pid=7162 uid=10067 g
ids={3003, 1015, 1028}
I/dalvikvm( 7162): Turning on JNI app bug workarounds for target SDK version 10.
..
I/ActivityThread( 7162): Pub MyApplication.mono.MonoRuntimeProvider.__mono_init__
: mono.MonoRuntimeProvider
D/dalvikvm( 7162): Trying to load lib /data/data/MyApplication/lib/libmonodroid.s
o 0x4266ae60
D/dalvikvm( 7162): Added shared lib /data/data/MyApplication/lib/libmonodroid.so
0x4266ae60
F/MonoDroid( 7162): **This installation has expired**.
D/Zygote  (  125): Process 7162 exited cleanly (11)

虽然试用启动屏幕说明,该版本将工作24小时 - 它会因某种原因立即过期。哦,我可以忍受。

更新: 是的,我购买并激活许可证后问题就消失了。