我正在尝试使用以下代码在本机中打开Webview:
render() {
console.log("URL in webview:" +this.props.navigation.state.params.url);
return <WebView source={{ uri: this.props.navigation.state.params.url }} />;
}
但是当我尝试打开一个URL时,它给出了:
Rejecting re-init on previously-failed class java.lang.Class: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/webkit/TracingController; at java.lang.Class java.lang.Class.classForName!(java.lang.String, boolean, java.lang.ClassLoader) (Class.java:-2) at java.lang.Class java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (Class.java:400) at java.lang.Class android.webkit.WebViewFactory.getProviderClass() (WebViewFactory.java:349) at android.webkit.WebViewFactoryProvider android.webkit.WebViewFactory.getProvider() (WebViewFactory.java:194) at android.webkit.WebViewFactoryProvider android.webkit.WebView.getFactory() (WebView.java:2331) at void android.webkit.WebView.ensureProviderCreated() (WebView.java:2326) at void android.webkit.WebView.setOverScrollMode(int) (WebView.java:2385) at void android.view.View.(android.content.Context) (View.java:4007) at void android.view.View.(android.content.Context, android.util.AttributeSet, int, int) (View.java:4126) at void android.view.ViewGroup.(android.content.Context, android.util.AttributeSet, int, int) (ViewGroup.java:578) at void android.widget.AbsoluteLayout.(android.content.Context, android.util.AttributeSet, int, int) (AbsoluteLayout.java:55) at void android.webkit.WebView.(android.content.Context, android.util.AttributeSet, int, int, java.util.Map, boolean) (WebView.java:627) at void android.webkit.WebView.(android.content.Context, android.util.AttributeSet, int, int) (WebView.java:572) at void android.webkit.WebView.(android.content.Context, android.util.AttributeSet, int) (WebView.java:555) at void android.webkit.WebView.(android.content.Context, android.util.AttributeSet) (WebView.java:542) at void android.webkit.WebView.(android.content.Context) (WebView.java:532) at void com.facebook.react.views.webview.ReactWebViewManager$ReactWebView.(com.facebook.react.uimanager.ThemedReactContext) (ReactWebViewManager.java:248) at com.facebook.react.views.webview.ReactWebViewManager$ReactWebView com.facebook.react.views.webview.ReactWebViewManager.createReactWebViewInstance(com.facebook.react.uimanager.ThemedReactContext) (ReactWebViewManager.java:357) at android.webkit.WebView com.facebook.react.views.webview.ReactWebViewManager.createViewInstance(com.facebook.react.uimanager.ThemedReactContext) (ReactWebViewManager.java:362) at android.view.View com.facebook.react.views.webview.ReactWebViewManager.createViewInstance(com.facebook.react.uimanager.ThemedReactContext) (ReactWebViewManager.java:86) at android.view.View com.facebook.react.uimanager.ViewManager.createView(com.facebook.react.uimanager.ThemedReactContext, com.facebook.react.touch.JSResponderHandler) (ViewManager.java:44) at void com.facebook.react.uimanager.NativeViewHierarchyManager.createView(com.facebook.react.uimanager.ThemedReactContext, int, java.lang.String, com.facebook.react.uimanager.ReactStylesDiffMap) (NativeViewHierarchyManager.java:224) at void com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute() (UIViewOperationQueue.java:153) at void com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations(long) (UIViewOperationQueue.java:1006) at void com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(long) (UIViewOperationQueue.java:977) at void com.facebook.react.uimanager.GuardedFrameCallback.doFrame(long) (GuardedFrameCallback.java:31) at void com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(long) (ReactChoreographer.java:136) at void com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(long) (ChoreographerCompat.java:107) at void android.view.Choreographer$CallbackRecord.run(long) (Choreographer.java:871) at void android.view.Choreographer.doCallbacks(int, long) (Choreographer.java:685) at void android.view.Choreographer.doFrame(long, int) (Choreographer.java:618) at void android.view.Choreographer$FrameDisplayEventReceiver.run() (Choreographer.java:859) at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:754) at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:95) at void android.os.Looper.loop() (Looper.java:165) at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6365) 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:883) at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:773) Caused by: java.lang.ClassNotFoundException: Didn't find class "android.webkit.TracingController" on path: DexPathList[[zip file "/data/app/com.android.chrome-2/base.apk"],nativeLibraryDirectories=[/data/app/com.android.chrome-2/lib/arm, /data/app/com.android.chrome-2/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]] ...
该代码适用于API级别28,但是抛出了API级别24错误。我搜索了TracingController类是在API级别28中引入的,而我试图在API 24中打开webview,但是我没有知道如何配置它才能在API级别24中打开。
我的build.gradle文件:
defaultConfig {
minSdkVersion 21
targetSdkVersion com.amazon.brazil.android.SDK.platformVersion.toInteger()
关于如何打开WebView的任何提示,或者如何在API级别24中打开Webview? 如果我在API级别24上运行,为什么要尝试访问在API级别28中引入的文件?
答案 0 :(得分:2)
您可能会在this particular SO answer中看到相同的问题。
基本上,according to Google是在O +的WebView更改中引入的,并触发此消息被错误地记录在<= N个设备上的WebView代码中。这不是实际错误,因此您可以忽略它。
我在Webview代码中获得了与TracingController完全相同的NCDFE,并且可以确认它没有不良影响。不幸的是,它会向日志消息发送垃圾邮件,因此希望它们能尽快解决。