首页 > 解决方案 > Xamarin Forms 启动时出现空白屏幕

问题描述

我将 Xamarin Forms 用于我的移动应用程序。在我的应用程序的初始化中,我想加载我的配置。

我使用 Akavache 将其保存在缓存中。

当出现启动画面时,我在 App.xaml 的 onstart 方法中启动此方法。

它运行良好,但是当我调用 Akavache 缓存时,启动画面变成白色。我的代码运行良好,但屏幕上没有出现任何内容。

如果我请求我的 api 而不是使用缓存来获取配置,这是相同的行为。

我也尝试在我的主要活动 android 部分中移动 GetConfig 方法,但我有相同的行为。

如果我删除这个电话,一切都会很好。

您将在下面找到输出。

我认为它与 GetRenderableInternalFormatInfoEntry: Unsupported renderable internal format 37808 有关

我该如何解决?

[0:] LogHost: Initializing Akavache
11-19 14:46:06.326 D/Mono    (26273): DllImport searching in: 'e_sqlite3' ('libe_sqlite3.so').
11-19 14:46:06.326 D/Mono    (26273): Searching for 'sqlite3_open_v2'.
11-19 14:46:06.333 D/Mono    (26273): DllImport searching in: 'e_sqlite3' ('libe_sqlite3.so').
11-19 14:46:06.333 D/Mono    (26273): Searching for 'sqlite3_busy_timeout'.
11-19 14:46:06.385 D/Mono    (26273): DllImport searching in: 'e_sqlite3' ('libe_sqlite3.so').
11-19 14:46:06.385 D/Mono    (26273): Searching for 'sqlite3_prepare_v2'.
11-19 14:46:06.398 D/Mono    (26273): DllImport searching in: 'e_sqlite3' ('libe_sqlite3.so').
11-19 14:46:06.398 D/Mono    (26273): Searching for 'sqlite3_step'.
11-19 14:46:06.402 D/Mono    (26273): DllImport searching in: 'e_sqlite3' ('libe_sqlite3.so').
11-19 14:46:06.402 D/Mono    (26273): Searching for 'sqlite3_column_type'.
11-19 14:46:06.408 D/Mono    (26273): DllImport searching in: 'e_sqlite3' ('libe_sqlite3.so').
11-19 14:46:06.408 D/Mono    (26273): Searching for 'sqlite3_column_int'.
11-19 14:46:06.412 D/Mono    (26273): DllImport searching in: 'e_sqlite3' ('libe_sqlite3.so').
11-19 14:46:06.412 D/Mono    (26273): Searching for 'sqlite3_finalize'.
11-19 14:46:06.417 D/Mono    (26273): DllImport searching in: 'e_sqlite3' ('libe_sqlite3.so').
11-19 14:46:06.418 D/Mono    (26273): Searching for 'sqlite3_changes'.
11-19 14:46:06.421 D/Mono    (26273): Requesting loading reference 6 (of 10) of 
11-19 14:46:06.422 D/Mono    (26273): Assembly Ref addref Akavache.Sqlite3[0xefcbab00] -> System.Core[0xefc9ff20]: 10
11-19 14:46:06.497 D/Mono    (26273): DllImport searching in: 'e_sqlite3' ('libe_sqlite3.so').
11-19 14:46:06.497 D/Mono    (26273): Searching for 'sqlite3_column_count'.
11-19 14:46:06.500 D/Mono    (26273): DllImport searching in: 'e_sqlite3' ('libe_sqlite3.so').
11-19 14:46:06.500 D/Mono    (26273): Searching for 'sqlite3_column_name'.
11-19 14:46:06.509 D/Mono    (26273): DllImport searching in: 'e_sqlite3' ('libe_sqlite3.so').
11-19 14:46:06.509 D/Mono    (26273): Searching for 'sqlite3_column_text'.
11-19 14:46:06.509 D/Mono    (26273): DllImport searching in: 'e_sqlite3' ('libe_sqlite3.so').
11-19 14:46:06.509 D/Mono    (26273): Searching for 'sqlite3_column_bytes'.
11-19 14:46:07.000 D/Mono    (26273): DllImport searching in: 'e_sqlite3' ('libe_sqlite3.so').
11-19 14:46:07.000 D/Mono    (26273): Searching for 'sqlite3_reset'.
11-19 14:46:07.035 D/Mono    (26273): DllImport searching in: 'e_sqlite3' ('libe_sqlite3.so').
11-19 14:46:07.035 D/Mono    (26273): Searching for 'sqlite3_errmsg'.
11-19 14:46:07.049 I/com.myapp(26273): Waiting for a blocking GC ProfileSaver
11-19 14:46:07.075 I/com.myapp(26273): WaitForGcToComplete blocked ProfileSaver on HeapTrim for 25.617ms
11-19 14:46:07.086 D/ViewRootImpl@3b6f7dc[MainActivity](26273): setView = com.android.internal.policy.DecorView@cbb66b6 TM=true MM=false
11-19 14:46:07.100 D/Mono    (26273): DllImport searching in: 'e_sqlite3' ('libe_sqlite3.so').
11-19 14:46:07.100 D/Mono    (26273): Searching for 'sqlite3_bind_text'.
11-19 14:46:07.197 D/Mono    (26273): DllImport searching in: '__Internal' ('(null)').
11-19 14:46:07.197 D/Mono    (26273): Searching for 'java_interop_jnienv_call_nonvirtual_int_method_a'.
11-19 14:46:07.197 D/Mono    (26273): Probing 'java_interop_jnienv_call_nonvirtual_int_method_a'.
11-19 14:46:07.197 D/Mono    (26273): Found as 'java_interop_jnienv_call_nonvirtual_int_method_a'.
11-19 14:46:07.219 E/GraphicExt(26273): Can't load libboost_ext_fwk
11-19 14:46:07.219 E/GraphicExt(26273): GraphicExtModuleLoader::CreateGraphicExtInstance false
11-19 14:46:07.219 D/ViewRootImpl@3b6f7dc[MainActivity](26273): Relayout returned: old=(0,0,720,1520) new=(0,0,720,1520) req=(720,1520)0 dur=13 res=0x7 s={true 2995832832} ch=true
11-19 14:46:07.224 D/OpenGLRenderer(26273): createReliableSurface : 0xd3087f40(0xb290c800)
11-19 14:46:07.225 I/GPUD    (26273): @gpudInitialize: successfully initialized with 1, dbg=0 mmdump_dbg=0
11-19 14:46:07.244 D/OpenGLRenderer(26273): makeCurrent EglSurface : 0x0 -> 0x0
11-19 14:46:07.244 I/GPUD    (26273): @gpudInitialize: successfully initialized with 4, dbg=0 mmdump_dbg=0
11-19 14:46:07.245 I/chatty  (26273): uid=10218(com.myapp) RenderThread identical 2 lines
11-19 14:46:07.245 I/GPUD    (26273): @gpudInitialize: successfully initialized with 4, dbg=0 mmdump_dbg=0
11-19 14:46:07.248 D/Mono    (26273): Requesting loading reference 1 (of 2) of Java.Interop.dll
11-19 14:46:07.248 D/Mono    (26273): Loading reference 1 of Java.Interop.dll asmctx DEFAULT, looking for System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
11-19 14:46:07.248 D/Mono    (26273): Assembly Ref addref Java.Interop[0xbf22e9e0] -> System.Core[0xefc9ff20]: 11
11-19 14:46:07.257 I/GPUD    (26273): @gpudInitialize: successfully initialized with 4, dbg=0 mmdump_dbg=0
11-19 14:46:07.269 I/chatty  (26273): uid=10218(com.myapp) RenderThread identical 4 lines
11-19 14:46:07.269 I/GPUD    (26273): @gpudInitialize: successfully initialized with 4, dbg=0 mmdump_dbg=0
11-19 14:46:07.270 E/IMGSRV  (26273): :0: GetRenderableInternalFormatInfoEntry: Unsupported renderable internal format 37808
11-19 14:46:07.270 E/IMGSRV  (26273): :0: GetRenderableInternalFormatInfoEntry: Unsupported renderable internal format 37810
11-19 14:46:07.270 E/IMGSRV  (26273): :0: GetRenderableInternalFormatInfoEntry: Unsupported renderable internal format 37809
11-19 14:46:07.270 E/IMGSRV  (26273): :0: GetRenderableInternalFormatInfoEntry: Unsupported renderable internal format 37811
11-19 14:46:07.270 E/IMGSRV  (26273): :0: GetRenderableInternalFormatInfoEntry: Unsupported renderable internal format 37812
11-19 14:46:07.270 E/IMGSRV  (26273): :0: GetRenderableInternalFormatInfoEntry: Unsupported renderable internal format 37813
11-19 14:46:07.270 E/IMGSRV  (26273): :0: GetRenderableInternalFormatInfoEntry: Unsupported renderable internal format 37814
11-19 14:46:07.270 E/IMGSRV  (26273): :0: GetRenderableInternalFormatInfoEntry: Unsupported renderable internal format 37815
11-19 14:46:07.270 E/IMGSRV  (26273): :0: GetRenderableInternalFormatInfoEntry: Unsupported renderable internal format 37816
11-19 14:46:07.270 E/IMGSRV  (26273): :0: GetRenderableInternalFormatInfoEntry: Unsupported renderable internal format 37817
11-19 14:46:07.270 E/IMGSRV  (26273): :0: GetRenderableInternalFormatInfoEntry: Unsupported renderable internal format 37818
11-19 14:46:07.270 E/IMGSRV  (26273): :0: GetRenderableInternalFormatInfoEntry: Unsupported renderable internal format 37819
11-19 14:46:07.270 E/IMGSRV  (26273): :0: GetRenderableInternalFormatInfoEntry: Unsupported renderable internal format 37820
11-19 14:46:07.270 E/IMGSRV  (26273): :0: GetRenderableInternalFormatInfoEntry: Unsupported renderable internal format 37821
11-19 14:46:07.275 D/OpenGLRenderer(26273): makeCurrent EglSurface : 0x0 -> 0xdda1e200
11-19 14:46:07.279 W/Gralloc3(26273): mapper 3.x is not supported
11-19 14:46:07.283 E/ion     (26273): ioctl c0044901 failed with code -1: Invalid argument
11-19 14:46:07.288 I/GPUD    (26273): @gpudInitialize: successfully initialized with 4, dbg=0 mmdump_dbg=0
11-19 14:46:07.295 I/GPUD    (26273): @gpudInitialize: successfully initialized with 4, dbg=0 mmdump_dbg=0
11-19 14:46:07.311 D/ViewRootImpl@3b6f7dc[MainActivity](26273): MSG_WINDOW_FOCUS_CHANGED 1 1
11-19 14:46:07.312 D/InputMethodManager(26273): prepareNavigationBarInfo() DecorView@cbb66b6[MainActivity]
11-19 14:46:07.312 D/InputMethodManager(26273): getNavigationBarColor() -855310
11-19 14:46:07.317 D/InputMethodManager(26273): prepareNavigationBarInfo() DecorView@cbb66b6[MainActivity]
11-19 14:46:07.317 D/InputMethodManager(26273): getNavigationBarColor() -855310
11-19 14:46:07.317 V/InputMethodManager(26273): Starting input: tba=com.myapp ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
11-19 14:46:07.318 D/InputMethodManager(26273): startInputInner - Id : 0
11-19 14:46:07.318 I/InputMethodManager(26273): startInputInner - mService.startInputOrWindowGainedFocus
11-19 14:46:07.396 I/System.out(26273): (HTTPLog)-Static: isSBSettingEnabled false
11-19 14:46:07.396 I/System.out(26273): (HTTPLog)-Static: isSBSettingEnabled false

更新

如果我在我的方法 DependencyResolver.Resolve().Initialize() 之后添加我的调用,它会起作用。

方法初始化启动 FirstContentPage。

我的主要活动标题:我不使用闪屏活动。

[Activity(
    Label = "@string/app_name",
    Icon = "@drawable/icon",
    Theme = "@style/MyTheme.Splash",
    MainLauncher = true,
    ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.Locale | ConfigChanges.LayoutDirection, ScreenOrientation = ScreenOrientation.Portrait
    )
]

我的 app.xaml.cs OnStart

protected override async void OnStart()
    {

        base.OnStart();

        await UserConfigurationManager.GetAsync(); // Make splash screen blank and no more screens appear
        await DependencyResolver.Resolve<INavigationService>().Initialize();
        
        OnResume();
    }

// UserConfigurationManager.GetAsync() 的详细信息;

if (IsUserLoggedIn)
        {
            try
            {
                confsaved = await BlobCache.UserAccount.GetObject<UserConfigurationDto>("loggedconfig");
            }
            catch
            {
            }

        }
        else
        {
            try
            {
                confsaved = await BlobCache.UserAccount.GetObject<UserConfigurationDto>("anonymousconfig");
            }
            catch
            {
            }
        }

标签: androidxamarinxamarin.formsxamarin.androidakavache

解决方案


推荐阅读