我正在尝试使用Javascript / Typescript网站创建将成为HTML5包装器的本机应用程序。在这个网站上,有很多视频。当我在原生Chrome应用程序中打开此网站时,它的工作正常,但是当我在我的应用程序中打开此网站时,由于视频未正确加载,因此无法正常工作。下面是代码和日志。这有什么问题?我尝试使用传统的WebClient和WebChromeClient,但它没有解决这个问题。
Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView webView= new WebView(this);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setSupportMultipleWindows(true);
webView.setWebChromeClient(new WebChromeClient(){
@Override
public void onReceivedTitle(WebView view, String title) {
getWindow().setTitle(title); //Set Activity tile to page title.
}
});
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return false;
}
});
webView.loadUrl("http://192.168.1.182:10000");
}
和日志
I/art: Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.WebViewContentsClientAdapter$7>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/webkit/RenderProcessGoneDetail;
at void com.android.webview.chromium.WebViewChromium.init(java.util.Map, boolean) (WebViewChromium.java:48)
at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int, java.util.Map, boolean) (WebView.java:-1)
at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int) (WebView.java:-1)
at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int) (WebView.java:-1)
I/art: at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet) (WebView.java:-1)
at void android.webkit.WebView.<init>(android.content.Context) (WebView.java:-1)
at void test.tv_cli.WebViewActivity.onCreate(android.os.Bundle) (WebViewActivity.java:58)
at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:-1)
at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:-1)
at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:-1)
at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:-1)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:-1)
at void android.os.Looper.loop() (Looper.java:-1)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:-1)
at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:-1)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:-1)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.webkit.RenderProcessGoneDetail" on path: DexPathList[[zip file "/data/app/com.google.android.webview-2/base.apk"],nativeLibraryDirectories=[/data/app/com.google.android.webview-2/lib/arm64, /data/app/com.google.android.webview-2/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
at void com.android.webview.chromium.WebViewChromium.init(java.util.Map, boolean) (WebViewChromium.java:48)
at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int, java.util.Map, boolean) (WebView.java:-1)
at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int) (WebView.java:-1)
at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int) (WebView.java:-1)
at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet) (WebView.java:-1)
at void android.webkit.WebView.<init>(android.content.Context) (WebView.java:-1)
at void test.tv_cli.WebViewActivity.onCreate(android.os.Bundle) (WebViewActivity.java:58)
at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:-1)
at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:-1)
at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:-1)
at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:-1)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:-1)
at void android.os.Looper.loop() (Looper.java:-1)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:-1)
at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:-1)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:-1)
I/art: Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.WebViewContentsClientAdapter$3>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/webkit/SafeBrowsingResponse;
at void com.android.webview.chromium.WebViewChromium.init(java.util.Map, boolean) (WebViewChromium.java:48)
at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int, java.util.Map, boolean) (WebView.java:-1)
at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int) (WebView.java:-1)
at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int) (WebView.java:-1)
at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet) (WebView.java:-1)
at void android.webkit.WebView.<init>(android.content.Context) (WebView.java:-1)
at void test.tv_cli.WebViewActivity.onCreate(android.os.Bundle) (WebViewActivity.java:58)
at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:-1)
at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:-1)
at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:-1)
at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:-1)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:-1)
at void android.os.Looper.loop() (Looper.java:-1)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:-1)
at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:-1)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:-1)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.webkit.SafeBrowsingResponse" on path: DexPathList[[zip file "/data/app/com.google.android.webview-2/base.apk"],nativeLibraryDirectories=[/data/app/com.google.android.webview-2/lib/arm64, /data/app/com.google.android.webview-2/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
at void com.android.webview.chromium.WebViewChromium.init(java.util.Map, boolean) (WebViewChromium.java:48)
at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int, java.util.Map, boolean) (WebView.java:-1)
at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int) (WebView.java:-1)
I/art: at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int) (WebView.java:-1)
at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet) (WebView.java:-1)
at void android.webkit.WebView.<init>(android.content.Context) (WebView.java:-1)
at void test.tv_cli.WebViewActivity.onCreate(android.os.Bundle) (WebViewActivity.java:58)
at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:-1)
at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:-1)
at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:-1)
at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:-1)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:-1)
at void android.os.Looper.loop() (Looper.java:-1)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:-1)
at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:-1)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:-1)
D/EgretLoader: EgretLoader(Context context)
D/EgretLoader: The context is not activity
W/cr_media: Requires BLUETOOTH permission
E/libEGL: validate_display:99 error 3008 (EGL_BAD_DISPLAY)
I/Adreno: QUALCOMM build : d57aba2, Ic27b94dfce
Build Date : 10/26/16
OpenGL ES Shader Compiler Version: XE031.09.00.03
Local Branch :
Remote Branch :
Remote Branch :
Reconstruct Branch :
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@3677baf
BoostFramework() : mPerf = com.qualcomm.qti.Performance@3192bbc
W/VideoCapabilities: Unrecognized profile 2130706433 for video/avc
Unrecognized profile 2130706434 for video/avc
W/VideoCapabilities: Unrecognized profile 2130706433 for video/avc
Unrecognized profile 2130706434 for video/avc
W/VideoCapabilities: Unrecognized profile 2130706433 for video/avc
Unrecognized profile 2130706434 for video/avc
W/VideoCapabilities: Unrecognized profile/level 0/3 for video/mpeg2
W/VideoCapabilities: Unrecognized profile/level 0/3 for video/mpeg2
W/VideoCapabilities: Unsupported mime video/x-ms-wmv
W/VideoCapabilities: Unsupported mime video/x-ms-wmv
W/VideoCapabilities: Unsupported mime video/divx
W/VideoCapabilities: Unsupported mime video/divx311
W/VideoCapabilities: Unsupported mime video/divx4
W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
W/AudioCapabilities: Unsupported mime audio/dsd
Unsupported mime audio/dts
W/AudioCapabilities: Unsupported mime audio/32KADPCM
W/VideoCapabilities: Unsupported mime video/mp4v-esdp
I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
D/ActivityThreadInjector: clearCachedDrawables.
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
I/chromium: [INFO:CONSOLE(0)] "Refused to execute script from 'http://192.168.1.182:10000/$MANAGER_WIDGET/Common/API/Widget.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.", source: http://192.168.1.182:10000/ (0)
W/art: Before Android 4.1, method int android.support.v7.widget.DropDownListView.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
I/chromium: [INFO:CONSOLE(0)] "Refused to execute script from 'http://192.168.1.182:10000/$MANAGER_WIDGET/Common/API/TVKeyValue.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.", source: http://192.168.1.182:10000/ (0)
I/chromium: [INFO:CONSOLE(12)] "Uncaught ReferenceError: Common is not defined", source: http://192.168.1.182:10000/ (12)
W/cr_CrashFileManager: /data/user/0/test.tv_cli/cache/WebView/Crash Reports does not exist or is not a directory
I/chromium: [INFO:CONSOLE(2697)] "[HMR] Waiting for update signal from WDS...", source: http://192.168.1.182:10000/bundle.js (2697)
I/chromium: [INFO:CONSOLE(858)] "start debug", source: http://192.168.1.182:10000/bundle.js (858)
I/chromium: [INFO:CONSOLE(3367)] "[WDS] Hot Module Replacement enabled.", source: http://192.168.1.182:10000/bundle.js (3367)
V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@b98fe31
I/chromium: [INFO:CONSOLE(12560)] "100[100-0]undefined", source: http://192.168.1.182:10000/bundle.js (12560)