uni-app在安卓13平板上反复开机自启动有几率出现白屏

发布于 1周前 作者 caililin 来自 Uni-App

uni-app在安卓13平板上反复开机自启动有几率出现白屏

操作步骤:

平板重复关-开机后,有几率出现APP启动白屏

预期结果:

平板开机后,APP自启不出现白屏,正常显示

实际结果:

平板反复开机后,APP自启有几率出现白屏,可点击、进入功能设置。必须重启1-2次后或关闭进程、重新打开APP,APP才正常显示。

bug描述:

应用场景

由于业务场景需要,APP需要在每天早晨平板开机后自动启动。

测试过程

为了保证APP正常启动,就通过手动关-开平板、设置平板开关机时间的方式来测试。

问题描述

  1. 多次重复关开机(手动关-开平板、设置平板自动开关机时间),APP自启动均有几率出现白屏;
  2. 白屏时,可点击、进入功能设置页面,但无之前设置的内容(缓存);
  3. 白屏时,有时重启平板1-2次依然白屏(需要重启3次左右才正常),或者关闭进程、点击APP重新进入才正常显示;

备注

  1. 同一安装包,装在安卓7的华为平板上,从未出现过白屏;
  2. 图一为正常显示及设置内容。 图二为白屏及设置内容(无缓存内容);

Image Image

项目信息

项目属性 信息
产品分类 uniapp/App
PC开发环境操作系统 Windows
PC开发环境操作系统版本号 win10家庭版
HBuilderX类型 正式
HBuilderX版本号 3.93
手机系统 Android
手机系统版本号 Android 13
手机厂商 酷比魔方平板
手机机型 iplay50min
页面类型 vue
vue版本 vue2
打包方式 云端
项目创建方式 HBuilderX
App下载地址或H5网址 https://www.pgyer.com/kB36PUD4

4 回复

升级HX版 重新打包验证下


验证过了,一样会出现白屏

用android studio导出了log文件: 17:38:30.781 I SetHeapTaggingLevel: tag level set to 0 17:38:30.820 E Not starting debugger since process cannot load the jdwp agent. 17:38:30.854 W Unable to open ‘/system_ext/framework/unisoc-framework.dm’: No such file or directory 17:38:30.854 W Unable to open ‘/system_ext/framework/unisoc-framework.dm’: No such file or directory 17:38:30.880 D Compat change id reported: 171979766; UID 10134; state: DISABLED 17:38:30.896 D Returning zygote-cached class loader: /system/framework/android.test.base.jar 17:38:31.055 V ANGLE Developer option for ‘uni.UNIEEB2561’ set to: ‘default’ 17:38:31.055 V ANGLE GameManagerService for uni.UNIEEB2561: false 17:38:31.055 V Neither updatable production driver nor prerelease driver is supported. 17:38:31.060 D No Network Security Config specified, using platform default 17:38:31.060 D No Network Security Config specified, using platform default 17:38:31.918 W App running slow: Executing handleBindApplication : installContentProviders took 838ms 17:38:31.937 I sPackageName=uni.UNIEEB2561; sDeviceRootDir=/data/user/0/uni.UNIEEB2561/; sBaseFsRootPath=/data/user/0/uni.UNIEEB2561/; sBaseFsRootFullPath=file:///data/user/0/uni.UNIEEB2561/; sBaseResRootFullPath=file:///android_asset/; 17:38:31.999 W Accessing hidden field Landroid/app/ActivityThread;->mHiddenApiWarningShown:Z (max-target-o, reflection, denied) 17:38:32.002 I ClassNotFoundException io.dcloud.common.cs.DL getInstance 17:38:32.026 W java.lang.NoSuchFieldException: UTSHooksClassArray 17:38:32.027 W at java.lang.Class.getField(Class.java:1635) 17:38:32.027 W at io.dcloud.uts.UTSAndroid.initUTSHooksClassArray(UTSAndroid.kt:948) 17:38:32.027 W at java.lang.reflect.Method.invoke(Native Method) 17:38:32.027 W at io.dcloud.common.util.AppRuntime.initUTSHooksClassArray(Unknown Source:14) 17:38:32.027 W at io.dcloud.weex.MoudlesLoader.initHooksClass(Unknown Source:49) 17:38:32.027 W at io.dcloud.feature.weex.WeexInstanceMgr.onCreateProcess(Unknown Source:4) 17:38:32.027 W at io.dcloud.common.util.AppRuntime.onCreateProcess(Unknown Source:7) 17:38:32.027 W at io.dcloud.application.DCLoudApplicationImpl.onCreate(Unknown Source:23) 17:38:32.027 W at io.dcloud.application.DCloudApplication.onCreate(Unknown Source:2) 17:38:32.027 W at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1266) 17:38:32.027 W at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6910) 17:38:32.027 W at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) 17:38:32.027 W at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2219) 17:38:32.027 W at android.os.Handler.dispatchMessage(Handler.java:106) 17:38:32.027 W at android.os.Looper.loopOnce(Looper.java:201) 17:38:32.027 W at android.os.Looper.loop(Looper.java:288) 17:38:32.027 W at android.app.ActivityThread.main(ActivityThread.java:8061) 17:38:32.027 W at java.lang.reflect.Method.invoke(Native Method) 17:38:32.027 W at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:703) 17:38:32.027 W at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) 17:38:32.028 I ClassNotFoundException io.dcloud.feature.weex.WeexDevtoolImpl registerReloadReceiver 17:38:32.044 I ClassNotFoundException io.dcloud.feature.cf.cFeatureImpl handleEncryption 17:38:32.045 I ClassNotFoundException io.dcloud.feature.cf.cFeatureImpl handleEncryption 17:38:32.057 I ClassNotFoundException io.dcloud.feature.cf.cFeatureImpl handleEncryption 17:38:32.061 I ClassNotFoundException io.dcloud.feature.weex.WeexDevtoolImpl initDebugEnvironment 17:38:32.080 D init start 17:38:32.081 D adding system library source: /vendor/lib64 17:38:32.081 D adding system library source: /system/lib64 17:38:32.082 D adding application source: com.facebook.soloader.DirectorySoSource[root = /data/app/~~euqawRy25TVwvu70uAk2wg==/uni.UNIEEB2561-MiUMTx3yHDvzoUr98Rtubg==/lib/arm64 flags = 0] 17:38:32.083 D adding backup source from : com.facebook.soloader.ApkSoSource[root = /data/user/0/uni.UNIEEB2561/lib-main flags = 1] 17:38:32.083 D Preparing SO source: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2] 17:38:32.083 D Preparing SO source: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2] 17:38:32.083 D Preparing SO source: com.facebook.soloader.DirectorySoSource[root = /data/app/~~euqawRy25TVwvu70uAk2wg==/uni.UNIEEB2561-MiUMTx3yHDvzoUr98Rtubg==/lib/arm64 flags = 0] 17:38:32.084 D Preparing SO source: com.facebook.soloader.ApkSoSource[root = /data/user/0/uni.UNIEEB2561/lib-main flags = 1] 17:38:32.086 V locked dso store /data/user/0/uni.UNIEEB2561/lib-main 17:38:32.090 I dso store is up-to-date: /data/user/0/uni.UNIEEB2561/lib-main 17:38:32.090 V releasing dso store lock for /data/user/0/uni.UNIEEB2561/lib-main 17:38:32.091 D init finish: 4 SO sources prepared 17:38:32.091 D init exiting 17:38:32.180 E tryUseRunTimeApi ? false 17:38:32.238 I java.lang.ClassNotFoundException: com.taobao.weex.devtools.inspector.elements.android.WXComponentDescriptor 17:38:32.260 I ClassNotFoundException io.dcloud.feature.cf.cFeatureImpl handleEncryption 17:38:32.276 I ClassNotFoundException io.dcloud.feature.weex_amap.AMapPluginImpl initPlugin 17:38:32.277 I ClassNotFoundException io.dcloud.feature.weex.map.google.GoogleMapPluginImpl initPlugin 17:38:32.280 I java.lang.ClassNotFoundException: com.taobao.weex.devtools.inspector.elements.android.WXComponentDescriptor 17:38:32.283 I java.lang.ClassNotFoundException: com.taobao.weex.devtools.inspector.elements.android.WXComponentDescriptor 17:38:32.285 I ClassNotFoundException io.dcloud.feature.weex_livepusher.LivePusherPlugin initPlugin 17:38:32.288 I java.lang.ClassNotFoundException: com.taobao.weex.devtools.inspector.elements.android.WXComponentDescriptor 17:38:32.291 I java.lang.ClassNotFoundException: com.taobao.weex.devtools.inspector.elements.android.WXComponentDescriptor 17:38:32.292 I java.lang.ClassNotFoundException: com.taobao.weex.devtools.inspector.elements.android.WXComponentDescriptor 17:38:32.295 I java.lang.ClassNotFoundException: com.taobao.weex.devtools.inspector.elements.android.WXComponentDescriptor 17:38:32.295 I java.lang.ClassNotFoundException: com.taobao.weex.devtools.inspector.elements.android.WXComponentDescriptor 17:38:32.297 I java.lang.ClassNotFoundException: com.taobao.weex.devtools.inspector.elements.android.WXComponentDescriptor 17:38:32.299 I java.lang.ClassNotFoundException: com.taobao.weex.devtools.inspector.elements.android.WXComponentDescriptor 17:38:32.300 I ClassNotFoundException io.dcloud.feature.weex_ad.DCWXAdPlugin initPlugin 17:38:32.300 W app AvailMemory ---->>>2287 17:38:32.301 I java.lang.ClassNotFoundException: com.taobao.weex.devtools.inspector.elements.android.WXComponentDescriptor 17:38:32.301 I getAssetPath---------uni-jsframework.js 17:38:32.302 I ClassNotFoundException io.dcloud.feature.x5.X5InitImpl init 17:38:32.394 E setCrashFilePath: /data/user/0/uni.UNIEEB2561/app_crash 17:38:32.395 W App running slow: Executing handleBindApplication : callApplicationOnCreate took 476ms 17:38:32.395 E weexjss’s Path is/data/app/~~euqawRy25TVwvu70uAk2wg==/uni.UNIEEB2561-MiUMTx3yHDvzoUr98Rtubg==/lib/arm64/libweexjss.so 17:38:32.409 E getUseSingleProcess is running false 17:38:32.409 E getReleaseMap:true 17:38:32.410 E getLibJsbPath is running /data/user/0/uni.UNIEEB2561/cache/cache/weex/libs/weexjsb/arm64-v8a/libweexjsb.so 17:38:32.410 E getLibLdPath is running /data/app/euqawRy25TVwvu70uAk2wg==/uni.UNIEEB2561-MiUMTx3yHDvzoUr98Rtubg==/lib/arm64:/data/app/euqawRy25TVwvu70uAk2wg==/uni.UNIEEB2561-MiUMTx3yHDvzoUr98Rtubg==/base.apk!/lib/arm64-v8a 17:38:32.417 W App running slow: Executing lich.uni.plugin.poweronautostart.BootBroadcastReceiver scheduleReceive took 1540ms 17:38:32.450 E startupPie :1 17:38:32.555 W type=1400 audit(0.0:113): avc: denied { setattr } for name=“libweexjsb.so” dev=“dm-39” ino=211211 scontext=u:r:untrusted_app_27:s0:c134,c256,c512,c768 tcontext=u:object_r:apk_data_file:s0 tclass=file permissive=0 app=uni.UNIEEB2561 17:38:32.532 D jsengine#weexcore fork child succes! 17:38:32.669 D performTraversals relayoutWindow: maybeSyncSeqId=-1 ,mSyncSeqId=0 ,relayoutResult=3 17:38:32.686 I jse start success!![bd4f07ed82121933f219915a2fa05a68438e55a2] 17:38:32.834 I ScriptBridgeInMultiProcess::InitFramework 17:38:32.884 I register: id=0x2870000005e, importpid=-1 17:38:32.884 I unregister: id=0x2870000005e, base=0x0, importpid=2265 17:38:32.885 I register: id=0x2870000005f, importpid=-1 17:38:32.887 I register: id=0x28700000060, importpid=-1 17:38:32.888 I register: id=0x28700000061, importpid=-1 17:38:32.911 W Expecting binder but got null! 17:38:32.922 E 1725615512922 17:38:32.924 D onCreate 17:38:32.927 I v8performance-InitV8[79]ms 17:38:32.928 W java.lang.ClassNotFoundException: io.dcloud.common.util.net.http.LocalServer2 17:38:32.928 W at java.lang.Class.classForName(Native Method) 17:38:32.928 W at java.lang.Class.forName(Class.java:454) 17:38:32.928 W at java.lang.Class.forName(Class.java:379) 17:38:32.928 W at io.dcloud.common.ui.PrivacyManager.isDebugMode(Unknown Source:1) 17:38:32.928 W at io.dcloud.b.onCreate(Unknown Source:8) 17:38:32.928 W at io.dcloud.WebAppActivity.onCreate(Unknown Source:22) 17:38:32.928 W at android.app.Activity.performCreate(Activity.java:8329) 17:38:32.928 W at android.app.Activity.performCreate(Activity.java:8308) 17:38:32.928 W at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1384) 17:38:32.928 W at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3750) 17:38:32.928 W at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3907) 17:38:32.928 W at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101) 17:38:32.928 W at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:137) 17:38:32.928 W at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) 17:38:32.928 W at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2393) 17:38:32.928 W at android.os.Handler.dispatchMessage(Handler.java:106) 17:38:32.928 W at android.os.Looper.loopOnce(Looper.java:201) 17:38:32.928 W at android.os.Looper.loop(Looper.java:288) 17:38:32.928 W at android.app.ActivityThread.main(ActivityThread.java:8061) 17:38:32.928 W at java.lang.reflect.Method.invoke(Native Method) 17:38:32.928 W at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:703) 17:38:32.928 W at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) 17:38:32.928 W Caused by: java.lang.ClassNotFoundException: io.dcloud.common.util.net.http.LocalServer2 17:38:32.928 W … 22 more 17:38:32.947 D call and retvalue:1008614 17:38:32.983 I Loading com.android.webview version 101.0.4951.61 (code 495156103) 17:38:33.001 D classloader namespace configured for unbundled product apk. library_path=/product/app/webview/lib/arm64:/product/app/webview/webview.apk!/lib/arm64-v8a:/product/lib64:/system/product/lib64 17:38:33.030 I ScriptBridgeInMultiProcess::ExecJSService 17:38:33.031 I ScriptBridgeInMultiProcess::ExecJSService 17:38:33.053 I Loaded version=101.0.4951.61 minSdkVersion=23 isBundle=false multiprocess=true packageId=2 17:38:33.238 I Successfully loaded native library 17:38:33.246 I Flushed 8 samples from 8 histograms. 17:38:33.257 D BaseActivity onCreate 17:38:33.257 D onRuntimePreCreate appid=Main_App 17:38:33.272 I WebAppActivity.onCreateSplash().appid=null this.appid=Main_App this=io.dcloud.PandoraEntryActivity@230f8cf 17:38:33.272 I WebAppActivity.onCreateSplash().mSplashView is Null =true 17:38:33.272 I onCreateSplash;intent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=uni.UNIEEB2561/io.dcloud.PandoraEntryActivity (has extras) } 17:38:33.272 I onCreateSplash hasSplash=true 17:38:33.272 I onCreateSplash splash_mode=auto 17:38:33.276 E Invalid ID 0x00000000. 17:38:33.276 D use defaultSplash 17:38:33.287 D Compat change id reported: 210923482; UID 10134; state: DISABLED 17:38:33.287 D Compat change id reported: 37756858; UID 10134; state: ENABLED 17:38:33.293 I ClassNotFoundException io.dcloud.appstream.actionbar.StreamAppActionBarUtil checkNeedTitleView 17:38:33.296 D checkAutoHide false 17:38:33.300 I onResume appid=Main_App 17:38:33.300 E 1725615513300 17:38:33.323 I unregister: id=0x28700000061, base=0x0, importpid=2265 17:38:33.323 I unregister: id=0x28700000060, base=0x0, importpid=2265 17:38:33.323 I unregister: id=0x2870000005f, base=0x0, importpid=2265 17:38:33.336 W memoryCache() and memoryCacheSize() calls overlap each other 17:38:33.345 W memoryCache() and memoryCacheSize() calls overlap each other 17:38:33.345 W discCache(), discCacheSize() and discCacheFileCount calls overlap each other 17:38:33.450 D call and retvalue:1008614 17:38:33.452 E wm adapter version not match 17:38:33.463 I 1 17:38:33.470 I onCreate appid=Main_App 17:38:33.714 D Compat change id reported: 183155436; UID 10134; state: DISABLED 17:38:33.907 W [WARNING:dns_config_service_android.cc(115)] Failed to read DnsConfig. 17:38:34.032 I onRuntimeCreate appid=Main_App 17:38:34.036 E fmgr no dp 17:38:34.049 I old_app_modify_date=1725612913000 17:38:34.049 I App Modify Date=1725612913000;_ret=false 17:38:34.050 E channel:uni.UNIEEB2561|UNIEEB2561|127254100803|common;ver:1.9.9.82065;max:3;trim:0;dg:false 17:38:34.069 E pass _permissionEle=[canvas, sqlite, videoplayer, uninview] 17:38:34.082 I Skipped 46 frames! The application may be doing too much work on its main thread. 17:38:34.101 D performTraversals relayoutWindow: maybeSyncSeqId=-1 ,mSyncSeqId=0 ,relayoutResult=3 17:38:34.106 I register: id=0x28700000062, importpid=-1 17:38:34.106 I unregister: id=0x28700000062, base=0x0, importpid=2265 17:38:34.108 I register: id=0x28700000063, importpid=-1 17:38:34.109 I register: id=0x28700000064, importpid=-1 17:38:34.110 I register: id=0x28700000065, importpid=-1 17:38:34.138 W Expecting binder but got null! 17:38:34.147 I Davey! duration=829ms; Flags=1, FrameTimelineVsyncId=3968, IntendedVsync=23505493840, Vsync=24271188082, InputEventId=0, HandleInputStart=24277215713, AnimationStart=24277216905, PerformTraversalsStart=24277217290, DrawStart=24299821982, FrameDeadline=23522160507, FrameInterval=24277143290, FrameStartTime=16645527, SyncQueued=24300599290, SyncStart=24300718367, IssueDrawCommandsStart=24300895021, SwapBuffers=24330585598, FrameCompleted=24335203059, DequeueBufferDuration=2459731, QueueBufferDuration=855885, GpuCompleted=24335203059, SwapBuffersCompleted=24332342021, DisplayPresentTime=5214991546389978975, CommandSubmissionCompleted=24330585598, 17:38:34.157 I AppMGr START_APP UNIEEB2561 17:38:34.162 I startOneApp UNI__EEB2561 17:38:34.166 W Accessing hidden field Lcom/android/internal/R$styleable;->Window_statusBarColor:I (max-target-o, reflection, denied) 17:38:34.166 W Accessing hidden field Lcom/android/internal/R$styleable;->Window_statusBarColor:I (max-target-o, reflection, denied) 17:38:34.236 D performTraversals relayoutWindow: maybeSyncSeqId=-1 ,mSyncSeqId=0 ,relayoutResult=0 17:38:34.251 I unregister: id=0x28700000065, base=0x0, importpid=2265 17:38:34.252 I register: id=0x28700000066, importpid=-1 17:38:34.253 W Access denied finding property “persist.unipnp.debug” 17:38:34.251 W type=1400 audit(0.0:121): avc: denied { read } for name=“u:object_r:unipnp_prop:s0” dev=“tmpfs” ino=17782 scontext=u:r:untrusted_app_27:s0:c134,c256,c512,c768 tcontext=u:object_r:unipnp_prop:s0 tclass=file permissive=0 app=uni.UNIEEB2561 17:38:34.251 W type=1400 audit(0.0:122): avc: denied { read } for name=“u:object_r:unipnp_prop:s0” dev=“tmpfs” ino=17782 scontext=u:r:untrusted_app_27:s0:c134,c256,c512,c768 tcontext=u:object_r:unipnp_prop:s0 tclass=file permissive=0 app=uni.UNIEEB2561 17:38:34.254 W Access denied finding property “persist.unipnp.debug” 17:38:34.255 W Unable to open ‘/system_ext/framework/unipnp-framework.dm’: No such file or directory 17:38:34.256 W Unable to open ‘/system_ext/framework/unipnp-framework.dm’: No such file or directory 17:38:34.281 I unregister: id=0x28700000064, base=0x0, importpid=2265 17:38:34.283 I register: id=0x28700000067, importpid=-1 17:38:34.298 W java.lang.NullPointerException: Attempt to invoke virtual method ‘int java.lang.String.length()’ on a null object reference 17:38:34.298 W at io.dcloud.e.b.e.convert2RelPath(Unknown Source:4) 17:38:34.298 W at io.dcloud.feature.weex.WXViewWrapper.getInitStringJsonData(Unknown Source:30) 17:38:34.298 W at io.dcloud.feature.weex.WXViewWrapper.access$700(Unknown Source:0) 17:38:34.298 W at io.dcloud.feature.weex.WXViewWrapper$9.run(Unknown Source:15) 17:38:34.298 W at android.os.Handler.handleCallback(Handler.java:942) 17:38:34.298 W at android.os.Handler.dispatchMessage(Handler.java:99) 17:38:34.298 W at android.os.Looper.loopOnce(Looper.java:201) 17:38:34.298 W at android.os.Looper.loop(Looper.java:288) 17:38:34.298 W at android.app.ActivityThread.main(ActivityThread.java:8061) 17:38:34.299 W at java.lang.reflect.Method.invoke(Native Method) 17:38:34.299 W at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:703) 17:38:34.299 W at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) 17:38:34.311 E idle from create instance cache size is 0 17:38:34.344 E end getBundleType type:Vue time:0 17:38:34.354 E createInstance :1725615514354 17:38:34.371 W java.lang.NullPointerException: Attempt to invoke virtual method ‘int java.lang.String.length()’ on a null object reference 17:38:34.371 W at io.dcloud.e.b.e.convert2RelPath(Unknown Source:4) 17:38:34.371 W at io.dcloud.feature.weex.WXViewWrapper.getInitStringJsonData(Unknown Source:30) 17:38:34.371 W at io.dcloud.feature.weex.WXViewWrapper.access$700(Unknown Source:0) 17:38:34.371 W at io.dcloud.feature.weex.WXViewWrapper$9.run(Unknown Source:15) 17:38:34.371 W at android.os.Handler.handleCallback(Handler.java:942) 17:38:34.371 W at android.os.Handler.dispatchMessage(Handler.java:99) 17:38:34.371 W at android.os.Looper.loopOnce(Looper.java:201) 17:38:34.371 W at android.os.Looper.loop(Looper.java:288) 17:38:34.371 W at android.app.ActivityThread.main(ActivityThread.java:8061) 17:38:34.371 W at java.lang.reflect.Method.invoke(Native Method) 17:38:34.371 W at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:703) 17:38:34.371 W at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911) 17:38:34.394 E end getBundleType type:Vue time:0 17:38:34.396 E createInstance :1725615514396 17:38:36.131 D performTraversals relayoutWindow: maybeSyncSeqId=-1 ,mSyncSeqId=0 ,relayoutResult=0 17:38:36.440 E new – JSNWindow=_www/uniappview.html 17:38:36.467 D Compat change id reported: 171228096; UID 10134; state: ENABLED 17:38:36.530 V receiver results: flags=6 enabled=false, enabledForAugmentedOnly: false 17:38:36.559 I recordForce value 6 17:38:36.597 W Requires BLUETOOTH permission 17:38:36.607 D Compat change id reported: 193247900; UID 10134; state: DISABLED 17:38:36.759 I Background concurrent copying GC freed 194578(11MB) AllocSpace objects, 251(29MB) LOS objects, 78% free, 6903KB/30MB, paused 166us,39us total 152.549ms 17:38:36.764 W A resource failed to call close. 17:38:36.764 W A resource failed to call close. 17:38:36.764 W A resource failed to call close. 17:38:36.764 W A resource failed to call close. 17:38:37.016 W (28) double-quoted string literal: “1725595622203” 17:38:37.018 E 1725615517018 17:38:37.018 E closeSplashScreen0 appid=UNIEEB2561;false;closeSplashDid=false 17:38:37.030 D performTraversals relayoutWindow: maybeSyncSeqId=-1 ,mSyncSeqId=0 ,relayoutResult=0 17:38:37.042 D About to load: libimagepipeline.so 17:38:37.042 D libimagepipeline.so not found on /data/user/0/uni.UNIEEB2561/lib-main 17:38:37.044 D libimagepipeline.so found on /data/app/~~euqawRy25TVwvu70uAk2wg==/uni.UNIEEB2561-MiUMTx3yHDvzoUr98Rtubg==/lib/arm64 17:38:37.044 D Not resolving dependencies for libimagepipeline.so 17:38:37.047 D true 17:38:37.047 D true 17:38:37.055 D Loaded: libimagepipeline.so 17:38:44.371 E 1725615524371 17:38:44.371 E closeSplashScreen0 appid=UNIEEB2561;true;closeSplashDid=true 17:38:46.106 W java.lang.NullPointerException: Attempt to invoke virtual method ‘int java.lang.String.length()’ on a null object reference 17:38:46.107 W at io.dcloud.e.b.e.convert2RelPath(Unknown Source:4) 17:38:46.107 W at io.dcloud.js.file.FileFeatureImpl.execute(Unknown Source:2908) 17:38:46.107 W at io.dcloud.g.b.a(Unknown Source:141) 17:38:46.107 W at io.dcloud.g.b.b(Unknown Source:3) 17:38:46.107 W at io.dcloud.g.b.processEvent(Unknown Source:174) 17:38:46.107 W at io.dcloud.e.c.c.dispatchEvent(Unknown Source:22) 17:38:46.107 W at io.dcloud.common.core.ui.l.processEvent(Unknown Source:2) 17:38:46.108 W at io.dcloud.common.adapter.ui.AdaUniWebView.exec(Unknown Source:7) 17:38:46.108 W at io.dcloud.common.adapter.ui.AdaUniWebView.prompt(Unknown Source:12) 17:38:46.108 W at io.dcloud.feature.weex.adapter.DCVueBridgeAdapter.execSync(Unknown Source:14) 17:38:46.108 W at com.taobao.weex.bridge.WXBridge.callVueExecSync(Unknown Source:31) 17:38:46.108 W at com.taobao.weex.base.SystemMessageHandler.nativeRunWork(Native Method) 17:38:46.108 W at com.taobao.weex.base.SystemMessageHandler.handleMessage(Unknown Source:2) 17:38:46.108 W at android.os.Handler.dispatchMessage(Handler.java:106) 17:38:46.108 W at android.os.Looper.loopOnce(Looper.java:201) 17:38:46.108 W at android.os.Looper.loop(Looper.java:288) 17:38:46.109 W at android.os.HandlerThread.run(HandlerThread.java:67) 17:38:46.117 W java.lang.NullPointerException: Attempt to invoke virtual method ‘int java.lang.String.length()’ on a null object reference 17:38:46.118 W at io.dcloud.e.b.e.convert2RelPath(Unknown Source:4) 17:38:46.118 W at io.dcloud.js.file.FileFeatureImpl.execute(Unknown Source:960) 17:38:46.118 W at io.dcloud.g.b.a(Unknown Source:141) 17:38:46.118 W at io.dcloud.g.b.b(Unknown Source:3) 17:38:46.118 W at io.dcloud.g.b.processEvent(Unknown Source:174) 17:38:46.118 W at io.dcloud.e.c.c.dispatchEvent(Unknown Source:22) 17:38:46.118 W at io.dcloud.common.core.ui.l.processEvent(Unknown Source:2) 17:38:46.118 W at io.dcloud.common.adapter.ui.AdaUniWebView.exec(Unknown Source:7) 17:38:46.118 W at io.dcloud.common.adapter.ui.AdaUniWebView$1.execute(Unknown Source:5) 17:38:46.119 W at io.dcloud.common.adapter.util.MessageHandler$1.handleMessage(Unknown Source:3) 17:38:46.119 W at android.os.Handler.dispatchMessage(Handler.java:106) 17:38:46.119 W at android.os.Looper.loopOnce(Looper.java:201) 17:38:46.119 W at android.os.Looper.loop(Looper.java:288) 17:38:46.119 W at android.app.ActivityThread.main(ActivityThread.java:8061) 17:38:46.119 W at java.lang.reflect.Method.invoke(Native Method) 17:38:46.119 W at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:703) 17:38:46.119 W at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)

在处理 uni-app 在安卓13平板上反复开机自启动时偶尔出现白屏的问题时,通常需要考虑的是应用启动时的生命周期管理、资源加载顺序以及可能的系统兼容性问题。以下是一些代码案例和思路,帮助你排查和解决问题。

1. 检查 App.vue 的生命周期钩子

确保 App.vue 中的 onLaunchonShow 钩子中没有执行可能导致应用崩溃或白屏的异步操作。例如,避免在这些钩子中直接进行复杂的网络请求或大量的数据计算。

export default {
  onLaunch: function() {
    // 简单初始化操作,避免复杂逻辑
    console.log('App Launch');
  },
  onShow: function() {
    // 仅在显示时执行的操作
    console.log('App Show');
  },
  // 其他生命周期钩子...
}

2. 延迟加载资源

如果应用在启动时立即加载大量资源(如图片、视频或复杂UI组件),可能会导致白屏。考虑使用延迟加载或按需加载策略。

<template>
  <view>
    <!-- 使用v-if控制资源加载时机 -->
    <image v-if="imageLoaded" :src="imageUrl" />
  </view>
</template>

<script>
export default {
  data() {
    return {
      imageLoaded: false,
      imageUrl: 'path/to/image.jpg'
    };
  },
  mounted() {
    this.loadImage();
  },
  methods: {
    loadImage() {
      setTimeout(() => {
        this.imageLoaded = true;
      }, 1000); // 模拟延迟加载
    }
  }
}
</script>

3. 捕获全局异常

main.js 中添加全局异常捕获,以便在发生未捕获异常时能够记录错误日志,有助于定位问题。

import Vue from 'vue'
import App from './App'

Vue.config.productionTip = false

Vue.prototype.$onError = function (err, vm, info) {
  console.error(`Error: ${err.toString()}\nInfo: ${info}`);
}

const app = new Vue({
    ...App
})
app.$mount()

4. 安卓特定权限和配置

确保在 manifest.json 中配置了安卓相关的权限和设置,特别是与自启动相关的权限。

"android": {
  "permissions": [
    "android.permission.RECEIVE_BOOT_COMPLETED"
  ],
  "auto_launch_on_startup": true
}

5. 测试与日志

在真实设备上进行充分测试,并使用安卓的日志工具(如 adb logcat)捕获和分析应用启动时的日志,以获取更多关于白屏问题的线索。

通过这些步骤,你可以逐步排查并可能解决 uni-app 在安卓13平板上反复开机自启动时偶尔白屏的问题。

回到顶部