You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Capacitor Android应用卡在启动闪屏页问题求助

Capacitor Android应用卡在启动闪屏页问题求助

大家好,我最近在学习CapacitorJS,想搭个简单的Android应用练手。我用npm init @capacitor/app@latest创建了新项目,用的是原生HTML/CSS/JS技术栈,全程只改动了src/index.html文件,把它替换成了一个极简的测试页面:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My App</title>
</head>
<body>
    <h1>Hello world!</h1>
</body>
</html>

安装完依赖后,用npm start跑web应用完全没问题,但执行npx cap run android的时候,模拟器能正常启动,却一直卡在Capacitor的闪屏页动不了。有意思的是,项目初始化时自带的src/index.html是能正常在Android模拟器里加载的,完全没毛病。

我已经试过这些操作,但都没解决问题:

  • 直接执行npx cap run android,全程没有任何报错
  • 用Android Studio打开项目构建并运行,也没有错误提示

下面是Logcat的日志内容:

2025-07-20 18:13:46.262 9014-9014 nativeloader com.example.app D Configuring clns-9 for other apk /data/app/~~c1Un-7qUkuBv9C_HyZ7K_A==/com.example.app-UyA2LePOf1PWFuo7tk8Mbw==/base.apk. target_sdk_version=35, uses_libraries=, library_path=/data/app/~~c1Un-7qUkuBv9C_HyZ7K_A==/com.example.app-UyA2LePOf1PWFuo7tk8Mbw==/lib/x86_64, permitted_path=/data:/mnt/expand:/data/user/0/com.example.app
2025-07-20 18:13:46.269 9014-9014 CompatChangeReporter com.example.app D Compat change id reported: 202956589; UID 10216; state: ENABLED
2025-07-20 18:13:46.273 9014-9014 com.example.app com.example.app I AssetManager2(0x7da51617aad8) locale list changing from [] to [en-US]
2025-07-20 18:13:46.279 9014-9014 GraphicsEnvironment com.example.app V Currently set values for:
2025-07-20 18:13:46.279 9014-9014 GraphicsEnvironment com.example.app V angle_gl_driver_selection_pkgs=[]
2025-07-20 18:13:46.279 9014-9014 GraphicsEnvironment com.example.app V angle_gl_driver_selection_values=[]
2025-07-20 18:13:46.279 9014-9014 GraphicsEnvironment com.example.app V com.example.app is not listed in per-application setting
2025-07-20 18:13:46.280 9014-9014 GraphicsEnvironment com.example.app V ANGLE allowlist from config:
2025-07-20 18:13:46.280 9014-9014 GraphicsEnvironment com.example.app V com.example.app is not listed in ANGLE allowlist or settings, returning default
2025-07-20 18:13:46.280 9014-9014 GraphicsEnvironment com.example.app V Neither updatable production driver nor prerelease driver is supported.
2025-07-20 18:13:46.294 9014-9014 CompatChangeReporter com.example.app D Compat change id reported: 279646685; UID 10216; state: ENABLED
2025-07-20 18:13:46.325 9014-9029 DisplayManager com.example.app I Choreographer implicitly registered for the refresh rate.
2025-07-20 18:13:46.342 9014-9014 com.example.app com.example.app I AssetManager2(0x7da51617dff8) locale list changing from [] to [en-US]
2025-07-20 18:13:46.370 9014-9014 AppCompatDelegate com.example.app D Checking for metadata for AppLocalesMetadataHolderService : Service not found
2025-07-20 18:13:46.370 9014-9014 com.example.app com.example.app I AssetManager2(0x7da516179b38) locale list changing from [] to [en-US]
2025-07-20 18:13:46.388 9014-9014 ashmem com.example.app E Pinning is deprecated since Android Q. Please use trim or other methods.
2025-07-20 18:13:46.473 9014-9029 EGL_emulation com.example.app I Opening libGLESv1_CM_emulation.so
2025-07-20 18:13:46.474 9014-9029 EGL_emulation com.example.app I Opening libGLESv2_emulation.so
2025-07-20 18:13:46.490 9014-9029 HWUI com.example.app W Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2025-07-20 18:13:46.491 9014-9029 HWUI com.example.app W Failed to initialize 101010-2 format, error = EGL_SUCCESS
2025-07-20 18:13:46.540 9014-9014 CompatChangeReporter com.example.app D Compat change id reported: 309578419; UID 10216; state: ENABLED
2025-07-20 18:13:46.542 9014-9014 DesktopModeFlags com.example.app D Toggle override initialized to: OVERRIDE_UNSET
2025-07-20 18:13:46.552 9014-9014 com.example.app com.example.app I hiddenapi: Accessing hidden method Landroid/view/ViewGroup;-&gt;makeOptionalFitsSystemWindows()V (runtime_flags=0, domain=platform, api=unsupported) from Landroidx/appcompat/widget/ViewUtils; (domain=app) using reflection: allowed
2025-07-20 18:13:46.567 9014-9014 com.example.app com.example.app I AssetManager2(0x7da516177bf8) locale list changing from [] to [en-US]
2025-07-20 18:13:46.568 9014-9014 WebViewFactory com.example.app I Loading com.google.android.webview version 133.0.6943.137 (code 694313738)
2025-07-20 18:13:46.570 9014-9014 com.example.app com.example.app I AssetManager2(0x7da51617ba78) locale list changing from [] to [en-US]
2025-07-20 18:13:46.573 9014-9014 com.example.app com.example.app I AssetManager2(0x7da516180578) locale list changing from [] to [en-US]
2025-07-20 18:13:46.578 9014-9014 com.example.app com.example.app I AssetManager2(0x7da51617f638) locale list changing from [] to [en-US]

想请教下各位,这种情况可能是什么原因导致的?我只改了index.html,为什么web端正常,Android端就卡在闪屏页了?

内容来源于stack exchange

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.07 12:05:29