Xamarin Android应用程序在启动屏幕上挂起

时间:2018-07-18 16:45:34

标签: xamarin.android release android-appcompat android-8.0-oreo reactiveui

我们正在使用 ReactiveUI 开发 Xamarin Android 应用。以下是技术规格,

  • Visual Studio 2017 15.7.4
  • 目标框架-Mono Android 8.0
  • NetStandard 2.0
  • ReactiveUI 8.2
  • Xamarin Android支持26.1.1
  • CompileSdkVersion-API级别26(Android 8.0)
  • TargetSdkVersion-API级别26(Android 8.0)
  • MinSdkVersion-API级别19(Android 4.4)

我的项目属性版本配置如下。

我使用华为API 19(指令集-armeabi-v8a。)测试了整个开发过程。调试和发布配置都可以。 我使用Theme.appCompat中的自定义主题作为应用程序主题。我在values和values-v21文件夹中有styles.xml。两者同名。我在“启动”屏幕中使用了一个 ProcessDialog ,它被确定为已弃用。问题出在哪里?我是Xamarin Android的新手。预先感谢。

更新: 以下是我的 MainActivity.cs 的外观。

using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.Graphics.Drawables;
using Android.OS;
using Android.Support.Design.Widget;
using Android.Support.V4.View;
using Android.Support.V4.Widget;
using Android.Support.V7.App;
using Android.Util;
using Android.Views;
using Android.Widget;
using DistributrIII.Mobile.Droid.Activities.Errors;
using DistributrIII.Mobile.Droid.Activities.Login;
using DistributrIII.Mobile.Droid.Activities.PointOfSale;
using DistributrIII.Mobile.Droid.Fragments.CloseOfTheDay;
using DistributrIII.Mobile.Droid.Fragments.Common;
using DistributrIII.Mobile.Droid.Fragments.Lossess;
using DistributrIII.Mobile.Droid.Fragments.Orders;
using DistributrIII.Mobile.Droid.Fragments.Outlets;
using DistributrIII.Mobile.Droid.Fragments.PointOfSale;
using DistributrIII.Mobile.Droid.Fragments.Reports;
using DistributrIII.Mobile.Droid.Fragments.SaleOrder;
using DistributrIII.Mobile.Droid.Fragments.PurchaseOrder;
using DistributrIII.Mobile.Droid.Fragments.Settings;
using DistributrIII.Mobile.Droid.Util;
using DistributrIII.Mobile.Lib.Model.Common;
using DistributrIII.Mobile.Lib.Model.Login;
using DistributrIII.Mobile.Lib.Model.Sync;
using DistributrIII.Mobile.Lib.VM.MainActivity;
using DistributrIII.Mobile.Lib.VM.Util;
using Java.Interop;
using Java.IO;
using ReactiveUI;
using System;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
using System.Threading;
using System.Threading.Tasks;
using static Android.Support.V7.App.ActionBar;
using static Android.Support.V7.Widget.SearchView;
using Environment = Android.OS.Environment;
using SearchView = Android.Support.V7.Widget.SearchView;
using DistributrIII.Mobile.Droid.Fragments.OpenTransactions;

namespace DistributrIII.Mobile.Droid
{
    [Activity(Label = "DistributrIII", MainLauncher = false, Theme = "@style/MainTheme")]
    public class MainActivity : DistributrBaseActivity<MainActivityVM>
    {
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);            
            SetContentView(Resource.Layout.activity_main);
            SetupUI(savedInstanceState);
        }

        #region UI Components
        DrawerLayout drawerLayout;
        NavigationView navigationView;
        IMenuItem previousItem;
        Android.Support.V7.Widget.Toolbar toolbar;
        DisplayScreen PreviousMenuItemId = DisplayScreen.None;
        SearchView searchControl;
        ProgressDialog progress;
        #endregion

        #region UI Helper Methods

        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            return base.OnPrepareOptionsMenu(menu);
        }


    private void SetupUI(Bundle savedInstanceState) {

        toolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
        toolbar.InflateMenu(Resource.Menu.main_menu);

        searchControl = (SearchView)toolbar.Menu.FindItem(Resource.Id.distributr_search).ActionView ;

        var textChangedObservable =
            Observable
                .FromEventPattern<QueryTextChangeEventArgs>(
                    x => searchControl.QueryTextChange += x,
                    x => searchControl.QueryTextChange -= x)
                .Select(x => x.EventArgs.NewText)
                .Throttle(TimeSpan.FromSeconds(1), TaskPoolScheduler.Default);


        var querySubmitObservable =
            Observable
                .FromEventPattern<QueryTextSubmitEventArgs>(
                    x => searchControl.QueryTextSubmit += x,
                    x => searchControl.QueryTextSubmit -= x)
                .Select(x => x.EventArgs.Query);

        SubscriptionDisposables.Add(
            Observable
                .Merge(textChangedObservable, querySubmitObservable)
                .Subscribe(async searchText =>  this.HandleSearch(searchText))

        );

        SetupNavigation(savedInstanceState);
        BottomNavigationView navigationView = (BottomNavigationView)FindViewById(Resource.Id.bottom_navigation);

        if (DIIIStaticStorage.LoginAccountType == LoginAccountType.Customer)
        {
            navigationView.InflateMenu(Resource.Menu.nav_bottom_customr);
        }
        else
        {
            navigationView.InflateMenu(Resource.Menu.nav_bottom);
        }

        navigationView.NavigationItemSelected += BottomNavigation_NavigationItemSelected;
        Android.Support.Design.Internal.BottomNavigationMenuView menuView = (Android.Support.Design.Internal.BottomNavigationMenuView)navigationView.GetChildAt(0);
        for (int i = 0; i < menuView.ChildCount; i++)
        {
            Android.Support.Design.Internal.BottomNavigationItemView itemView = (Android.Support.Design.Internal.BottomNavigationItemView)menuView.GetChildAt(i);
            itemView.SetShiftingMode(false);
            itemView.SetChecked(false);
        }

        //InvalidateOptionsMenu();
        toolbar.Title = "Distributr";
    }
}

我发现某些设备也陷入了调试模式。log有人可以告诉我什么错误。再次感谢

0 个答案:

没有答案