webentwicklung-frage-antwort-db.com.de

React-Native-Webview stürzt beim Aufrufen der Anwendung ab

Ich verwende die React-Native-Webview-Bibliothek zum Laden der Webseite. Sie funktioniert beim Debuggen einwandfrei, aber wenn ich einen Release-Build erstelle. Klicken Sie auf die Registerkarte, um die Webansicht zu laden. Die Anwendung stürzt ab. Folgendes ist der Fehler. Ich habe am Ende auch eine Fehlerverfolgung angehängt.

Ich verwende React-Native: "0.62.0" React-Native-Webview: "^ 9.0.2",

(sve

dies ist die Ablaufverfolgung, wenn ich auf die Schaltfläche klicke, um den Webview-Bildschirm zu laden.

> 2020-04-10 11:39:44.812 2584-2646/com.trackplayer E/ReactNativeJS:
> Error: crypto.getRandomValues() not supported. See
> https://github.com/uuidjs/uuid#getrandomvalues-not-supported
>     
>     This error is located at:
>         in n
>         in RCTView
>         in y
>         in Unknown
>         in Unknown
>         in Unknown
>         in Unknown
>         in RCTView
>         in S
>         in RCTView
>         in RCTView
>         in E
>         in RCTView
>         in c
>         in RCTView
>         in Unknown
>         in v
>         in Unknown
>         in w
>         in Unknown
>         in Unknown
>         in Unknown
>         in Unknown
>         in RCTView
>         in RCTView
>         in RCTView
>         in RCTView
>         in k
>         in ForwardRef
>         in PanGestureHandler
>         in RCTView
>         in k
>         in ForwardRef
>         in RCTView
>         in D
>         in Unknown
>         in RCTView
>         in C
>         in RCTView
>         in H
>         in S
>         in h
>         in RNCSafeAreaView
>         in Unknown
>         in Unknown
>         in GestureHandlerRootView
>         in Unknown
>         in b
>         in Unknown
>         in O
>         in Unknown
>         in ForwardRef
>         in Unknown
>         in ForwardRef
>         in S
>         in RCTView
>         in RCTView
>         in E 2020-04-10 11:39:44.818 2584-2646/com.trackplayer E/ReactNativeJS: Error: crypto.getRandomValues() not supported. See
> https://github.com/uuidjs/uuid#getrandomvalues-not-supported
>     
>     This error is located at:
>         in n
>         in RCTView
>         in y
>         in Unknown
>         in Unknown
>         in Unknown
>         in Unknown
>         in RCTView
>         in S
>         in RCTView
>         in RCTView
>         in E
>         in RCTView
>         in c
>         in RCTView
>         in Unknown
>         in v
>         in Unknown
>         in w
>         in Unknown
>         in Unknown
>         in Unknown
>         in Unknown
>         in RCTView
>         in RCTView
>         in RCTView
>         in RCTView
>         in k
>         in ForwardRef
>         in PanGestureHandler
>         in RCTView
>         in k
>         in ForwardRef
>         in RCTView
>         in D
>         in Unknown
>         in RCTView
>         in C
>         in RCTView
>         in H
>         in S
>         in h
>         in RNCSafeAreaView
>         in Unknown
>         in Unknown
>         in GestureHandlerRootView
>         in Unknown
>         in b
>         in Unknown
>         in O
>         in Unknown
>         in ForwardRef
>         in Unknown
>         in ForwardRef
>         in S
>         in RCTView
>         in RCTView
>         in E 2020-04-10 11:39:44.822 2584-2647/com.trackplayer E/unknown:ReactNative: Error: crypto.getRandomValues() not supported.
> See https://github.com/uuidjs/uuid#getrandomvalues-not-supported
>     
>     This error is located at:
>         in n
>         in RCTView
>         in y
>         in Unknown
>         in Unknown
>         in Unknown
>         in Unknown
>         in RCTView
>         in S
>         in RCTView
>         in RCTView
>         in E
>         in RCTView
>         in c
>         in RCTView
>         in Unknown
>         in v
>         in Unknown
>         in w
>         in Unknown
>         in Unknown
>         in Unknown
>         in Unknown
>         in RCTView
>         in RCTView
>         in RCTView
>         in RCTView
>         in k
>         in ForwardRef
>         in PanGestureHandler
>         in RCTView
>         in k
>         in ForwardRef
>         in RCTView
>         in D
>         in Unknown
>         in RCTView
>         in C
>         in RCTView
>         in H
>         in S
>         in h
>         in RNCSafeAreaView
>         in Unknown
>         in Unknown
>         in GestureHandlerRootView
>         in Unknown
>         in b
>         in Unknown
>         in O
>         in Unknown
>         in ForwardRef
>         in Unknown
>         in ForwardRef
>         in S
>         in RCTView
>         in RCTView
>         in E, stack:
>     [email protected]:132
>     [email protected]:329
>     [email protected]:2621
>     [email protected]:31529
>     [email protected]:49357
>     [email protected]:72034
>     [email protected]:71959
>     [email protected]:69253
>     [email protected]
>     <unknown>@92:25480
>     [email protected]:3503
>     [email protected]:25427
>     [email protected]:25362
>     [email protected]:90879
>     [email protected]:13478
>     [email protected]:13664
>     [email protected]:14448
>     [email protected]:3544
>     <unknown>@27:840
>     [email protected]:2798
>     [email protected]:812
>     [email protected] 2020-04-10 11:39:44.831 2584-2647/com.trackplayer E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
>     Process: com.trackplayer, PID: 2584
>     com.facebook.react.common.JavascriptException: Error: crypto.getRandomValues() not supported. See
> https://github.com/uuidjs/uuid#getrandomvalues-not-supported
>     
>     This error is located at:
>         in n
>         in RCTView
>         in y
>         in Unknown
>         in Unknown
>         in Unknown
>         in Unknown
>         in RCTView
>         in S
>         in RCTView
>         in RCTView
>         in E
>         in RCTView
>         in c
>         in RCTView
>         in Unknown
>         in v
>         in Unknown
>         in w
>         in Unknown
>         in Unknown
>         in Unknown
>         in Unknown
>         in RCTView
>         in RCTView
>         in RCTView
>         in RCTView
>         in k
>         in ForwardRef
>         in PanGestureHandler
>         in RCTView
>         in k
>         in ForwardRef
>         in RCTView
>         in D
>         in Unknown
>         in RCTView
>         in C
>         in RCTView
>         in H
>         in S
>         in h
>         in RNCSafeAreaView
>         in Unknown
>         in Unknown
>         in GestureHandlerRootView
>         in Unknown
>         in b
>         in Unknown
>         in O
>         in Unknown
>         in ForwardRef
>         in Unknown
>         in ForwardRef
>         in S
>         in RCTView
>         in RCTView
>         in E, stack:
>     [email protected]:132
>     [email protected]:329
>     [email protected]:2621
>     [email protected]:31529
>     [email protected]:49357
>     [email protected]:72034
>     [email protected]:71959
>     [email protected]:69253
>     [email protected]
>     <unknown>@92:25480
>     [email protected]:3503
>     [email protected]:25427
>     [email protected]:25362
>     [email protected]:90879
>     [email protected]:13478
>     [email protected]:13664
>     [email protected]:14448
>     [email protected]:3544
>     <unknown>@27:840
>     [email protected]:2798
>     [email protected]:812
>     [email protected]
>     
>         at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.Java:79)
>         at Java.lang.reflect.Method.invoke(Native Method)
>         at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.Java:372)
>         at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.Java:151)
>         at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
>         at Android.os.Handler.handleCallback(Handler.Java:883)
>         at Android.os.Handler.dispatchMessage(Handler.Java:100)
>         at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.Java:27)
>         at Android.os.Looper.loop(Looper.Java:214)
>         at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.Java:226)
>         at Java.lang.Thread.run(Thread.Java:919) 2020-04-10 11:39:44.850 2584-2647/com.trackplayer I/Process: Sending signal. PID:
> 2584 SIG: 9

das Problem wurde für mich behoben: `react-native-webview:" 8.0.4 ",

2
Wasif Mustahid

Das hat bei mir funktioniert. Ich habe es gerade benutzt.

 expo install react-native-webview
 "react-native-webview": "8.1.1"

 import { WebView } from 'react-native-webview'
 <WebView source={{ uri: 'https://expo.io' }} style={{ marginTop: 20, height: 500 }} />
1
learner

Installieren Sie react-native-get-random-values package .. Versuchen Sie anschließend, den Import ganz oben in der Datei zu verschieben.

index.js

Auf diese Weise hat es bei mir funktioniert ..

import 'react-native-get-random-values';
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);
0
ahmedfeyzi