我正在做一个小型网络摄像头查看器应用程序,我遇到了以下问题:一些URL加载完全正常,一个特定类型没有加载,而Logcat我无法理解为什么......
我正在Kotlin中编写此应用程序,因此wv_main只是位于 activity_web_view.xml FrameLayout 内 WebView 的合成链接。以下是我的 onCreate :
的代码super.onCreate(savedInstanceState)
setContentView(R.layout.activity_web_view)
val wv = wv_main
wv.settings.javaScriptEnabled = true
wv.settings.domStorageEnabled = true
if (Build.VERSION.SDK_INT >= 21)
wv.settings.mixedContentMode = WebSettings.MIXED_CONTENT_ALWAYS_ALLOW
wv.webChromeClient = WebChromeClient()
wv.webViewClient = WebViewClient()
wv.loadUrl(intent.getStringExtra("link"))
例如,如果我在URL后面传入此活动: https://api.lookr.com/embed/player/1485691420/day 然后它将被完美地解释并正确打开。 但是,如果我通过,例如,这样的事情: https://api.lookr.com/embed/player/1485691420/live 然后我不会像关闭应用程序的错误,而是看起来像WebView的内部错误:
Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.eb>:java.lang.NoClassDefFoundError: Failed resolution of: Landroid/webkit/RenderProcessGoneDetail;
12-27 18:52:08.012 10385-10385/com.example.elber.webcams I/art: at com.android.webview.chromium.Ap com.android.webview.chromium.WebViewChromiumFactoryProvider.G(android.webkit.WebView, android.content.Context) (WebViewChromiumFactoryProvider.java:323)
12-27 18:52:08.012 10385-10385/com.example.elber.webcams I/art: at void com.android.webview.chromium.WebViewChromium.init(java.util.Map, boolean) (WebViewChromium.java:42)
12-27 18:52:08.012 10385-10385/com.example.elber.webcams I/art: at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int, java.util.Map, boolean) (WebView.java:636)
12-27 18:52:08.012 10385-10385/com.example.elber.webcams I/art: at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int) (WebView.java:572)
12-27 18:52:08.012 10385-10385/com.example.elber.webcams I/art: at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int) (WebView.java:555)
12-27 18:52:08.012 10385-10385/com.example.elber.webcams I/art: at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet) (WebView.java:542)
12-27 18:52:08.012 10385-10385/com.example.elber.webcams I/art: at java.lang.Object java.lang.reflect.Constructor.newInstance0!(java.lang.Object[]) (Constructor.java:-2)
12-27 18:52:08.012 10385-10385/com.example.elber.webcams I/art: at java.lang.Object java.lang.reflect.Constructor.newInstance(java.lang.Object[]) (Constructor.java:430)
12-27 18:52:08.012 10385-10385/com.example.elber.webcams I/art: at android.view.View android.view.LayoutInflater.createView(java.lang.String, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:645)
12-27 18:52:08.012 10385-10385/com.example.elber.webcams I/art: at android.view.View com.android.internal.policy.PhoneLayoutInflater.onCreateView(java.lang.String, android.util.AttributeSet) (PhoneLayoutInflater.java:58)
12-27 18:52:08.012 10385-10385/com.example.elber.webcams I/art: at android.view.View android.view.LayoutInflater.onCreateView(android.view.View, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:717)
12-27 18:52:08.012 10385-10385/com.example.elber.webcams I/art: at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:785)
12-27 18:52:08.012 10385-10385/com.example.elber.webcams I/art: at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet) (LayoutInflater.java:727)
12-27 18:52:08.012 10385-10385/com.example.elber.webcams I/art: at void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:858)
12-27 18:52:08.012 10385-10385/com.example.elber.webcams I/art: at void android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, android.view.View, android.util.AttributeSet, boolean) (LayoutInflater.java:821)
12-27 18:52:08.012 10385-10385/com.example.elber.webcams I/art: at android.view.View android.view.LayoutInflater.inflate(org.xmlpull.v1.XmlPullParser, android.view.ViewGroup, boolean) (LayoutInflater.java:518)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup, boolean) (LayoutInflater.java:426)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup) (LayoutInflater.java:377)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.support.v7.app.AppCompatDelegateImplV9.setContentView(int) (AppCompatDelegateImplV9.java:287)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.support.v7.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:139)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void com.example.elber.webcams.WebViewActivity.onCreate(android.os.Bundle) (WebViewActivity.kt:16)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6662)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1118)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2599)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2707)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1460)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.os.Looper.loop() (Looper.java:154)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6077)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:866)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:756)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.webkit.RenderProcessGoneDetail" on path: DexPathList[[zip file "/data/app/com.android.chrome-1/base.apk"],nativeLibraryDirectories=[/data/app/com.android.chrome-1/lib/x86, /data/app/com.android.chrome-1/base.apk!/lib/x86, /system/lib, /vendor/lib]]
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at com.android.webview.chromium.Ap com.android.webview.chromium.WebViewChromiumFactoryProvider.G(android.webkit.WebView, android.content.Context) (WebViewChromiumFactoryProvider.java:323)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void com.android.webview.chromium.WebViewChromium.init(java.util.Map, boolean) (WebViewChromium.java:42)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int, java.util.Map, boolean) (WebView.java:636)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int) (WebView.java:572)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int) (WebView.java:555)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet) (WebView.java:542)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at java.lang.Object java.lang.reflect.Constructor.newInstance0!(java.lang.Object[]) (Constructor.java:-2)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at java.lang.Object java.lang.reflect.Constructor.newInstance(java.lang.Object[]) (Constructor.java:430)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at android.view.View android.view.LayoutInflater.createView(java.lang.String, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:645)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at android.view.View com.android.internal.policy.PhoneLayoutInflater.onCreateView(java.lang.String, android.util.AttributeSet) (PhoneLayoutInflater.java:58)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at android.view.View android.view.LayoutInflater.onCreateView(android.view.View, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:717)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:785)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet) (LayoutInflater.java:727)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:858)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, android.view.View, android.util.AttributeSet, boolean) (LayoutInflater.java:821)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at android.view.View android.view.LayoutInflater.inflate(org.xmlpull.v1.XmlPullParser, android.view.ViewGroup, boolean) (LayoutInflater.java:518)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup, boolean) (LayoutInflater.java:426)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup) (LayoutInflater.java:377)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.support.v7.app.AppCompatDelegateImplV9.setContentView(int) (AppCompatDelegateImplV9.java:287)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.support.v7.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:139)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void com.example.elber.webcams.WebViewActivity.onCreate(android.os.Bundle) (WebViewActivity.kt:16)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6662)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1118)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2599)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2707)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1460)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.os.Looper.loop() (Looper.java:154)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6077)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:866)
12-27 18:52:08.013 10385-10385/com.example.elber.webcams I/art: at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:756)
12-27 18:52:08.057 10385-10462/com.example.elber.webcams W/cr_media: Requires BLUETOOTH permission
12-27 18:52:08.118 10385-10477/com.example.elber.webcams E/libEGL: validate_display:99 error 3008 (EGL_BAD_DISPLAY)
12-27 18:52:08.126 10385-10385/com.example.elber.webcams W/art: Attempt to remove non-JNI local reference, dumping thread
12-27 18:52:08.129 10385-10410/com.example.elber.webcams D/EGL_emulation: eglMakeCurrent: 0xb6a85120: ver 2 0 (tinfo 0xb6a836b0)
12-27 18:52:08.157 10385-10477/com.example.elber.webcams I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
12-27 18:52:08.161 10385-10477/com.example.elber.webcams W/cr_MediaCodecUtil: HW encoder for video/avc is not available on this device.
12-27 18:52:08.167 10385:10477 D/HostConnection::get() New Host Connection established 0x938ead40, tid 10477
12-27 18:52:08.167 10385-10477/com.example.elber.webcams E/chromium: [ERROR:gl_surface_egl.cc(292)] eglChooseConfig failed with error EGL_SUCCESS
我在模拟器和OnePlus3T上运行Oreo时遇到了同样的错误。
可能是什么问题?例如,我看了一下Telegram的WebViewActivity代码,基本上它是一样的,但是在Telegram中这两个链接都没有任何问题,而在我的应用程序中只有一个......