小编Hum*_*hal的帖子

未能初始化 GeckoRuntime | 壁虎视图 | 安卓

 private fun setupGeckoView() {
        val runtime = GeckoRuntime.create(this) // crashes on this line
        geckoSession.open(runtime)
        geckoView.setSession(geckoSession)
        val url = String(Base64.decode(MYURL, Base64.DEFAULT))
        geckoSession.loadUri(url)
        geckoSession.progressDelegate = createProgressDelegate()
        geckoSession.settings.allowJavascript = true
    }
Run Code Online (Sandbox Code Playgroud)

我在 onCreat() 中调用了 setUpGeckoView 方法,但是当我单击返回并重新打开应用程序时,应用程序崩溃并显示 IllegalStateException,提示“无法初始化 GeckoRuntime。它第一次工作仅在我单击返回然后再次打开应用程序时崩溃”

日志如下

 Process: arholding.kargoshop.mk, PID: 16444
    java.lang.RuntimeException: Unable to start activity ComponentInfo{arholding.kargoshop.mk/arholding.kargoshop.mk.SeckoActivity}: java.lang.IllegalStateException: Failed to initialize GeckoRuntime
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3447)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3594)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        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:2146)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:7762)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1047)
     Caused by: java.lang.IllegalStateException: Failed …
Run Code Online (Sandbox Code Playgroud)

android webview kotlin geckoview

2
推荐指数
1
解决办法
804
查看次数

标签 统计

android ×1

geckoview ×1

kotlin ×1

webview ×1