uni-app Failed to load WebView provider: No WebView installed
uni-app Failed to load WebView provider: No WebView installed
开发环境 | 版本号 | 项目创建方式 |
---|---|---|
Windows | win11 | HBuilderX |
操作步骤:
- 纯nvue的模式下在没有webview的安卓机上无法启用app
预期结果:
- 纯nvue的模式下在没有webview的安卓机上可以启用app
实际结果:
- 纯nvue的模式下在没有webview的安卓机上无法启用app
bug描述:
Unable to start activity ComponentInfo{xxx/io.dcloud.PandoraEntryActivity}: android.util.AndroidRuntimeException: android.util.AndroidRuntimeException: android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to load WebView provider: No WebView installed
android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to load WebView provider: No WebView installed
at android.webkit.WebViewFactory.getWebViewContextAndSetProvider(WebViewFactory.java:428)
at android.webkit.WebViewFactory.getProviderClass(WebViewFactory.java:493)
at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:348)
at android.webkit.CookieManager.getInstance(CookieManager.java:50)
at io.dcloud.common.util.net.http.CookieManager.initCookieConfig(SourceFile:2)
at io.dcloud.b$c.a(SourceFile:9)
at io.dcloud.common.ui.b.a(SourceFile:336)
at io.dcloud.b.onCreate(SourceFile:47)
at io.dcloud.WebAppActivity.onCreate(SourceFile:24)
at android.app.Activity.performCreate(Activity.java:8238)
at android.app.Activity.performCreate(Activity.java:8206)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3708)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3909)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2260)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:210)
at android.os.Looper.loop(Looper.java:299)
at android.app.ActivityThread.main(ActivityThread.java:8108)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)
纯nvue的模式下在没有webview的安卓机上无法启用app。
我是离线sdk打包方式,CPU类型是全的,一些用户使用的是原生定制rom,所以很多不含webview,需要用户自己安装,这就显的开发的app必须依赖webview了,所以希望官方在纯nvue的模式下去掉webview的初始化。
回复 q***@qq.com: uni-app 需要webview,才能运行
回复 FullStack: 那要看官方愿不愿意改sdk了,不行只能看看weex那边行不行了,如果weex本身就必须依赖webview的话,那我改了sdk也没用。
回复 q***@qq.com: 一样的,都依赖
The error “Failed to load WebView provider: No WebView installed” in uni-app typically occurs when the Android device or emulator does not have a WebView component installed or enabled. WebView is a system component that allows apps to display web content. Here’s how you can resolve this issue:
1. Check WebView Installation
Ensure that the Android device or emulator has a WebView component installed:
- On a physical device: Most modern Android devices come with WebView pre-installed. If it’s missing, you can install it from the Google Play Store by searching for “Android System WebView.”
- On an emulator: Some Android emulators (e.g., Android Studio’s emulator) may not include WebView by default. You can install it manually or use an emulator image that includes WebView.
2. Enable WebView
If WebView is installed but disabled, enable it:
- Go to Settings > Apps (or Applications).
- Find Android System WebView in the list.
- If it’s disabled, enable it.
3. Update WebView
Ensure that WebView is up to date:
- Open the Google Play Store.
- Search for Android System WebView.
- If an update is available, install it.
4. Use a Different Emulator
If you’re using an emulator, try switching to one that includes WebView:
- Use the Google Play system image in Android Studio’s AVD Manager.
- Alternatively, use a third-party emulator like Genymotion or BlueStacks.
5. Modify uni-app Configuration
If the issue persists, you can try modifying the manifest.json
file in your uni-app project to specify a different WebView implementation:
{
"app-plus": {
"webview": {
"engine": "system"
}
}
}