Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 未显示任何内容(html)的Webview_Android_Webview_React Native - Fatal编程技术网

Android 未显示任何内容(html)的Webview

Android 未显示任何内容(html)的Webview,android,webview,react-native,Android,Webview,React Native,内容确实在emulator中完美地显示出来,并使用真实设备进行调试,但在使用released.apk使用真实设备进行测试时并没有显示任何内容。它只显示了白色的空白容器。还是我错过了什么 <WebView ref={(wView) => {this.wView = wView}} javaScriptEnabled={true} // onBridgeMessage={this.onBridgeMessage} onMessage={this.o

内容确实在emulator中完美地显示出来,并使用真实设备进行调试,但在使用released.apk使用真实设备进行测试时并没有显示任何内容。它只显示了白色的空白容器。还是我错过了什么

<WebView
     ref={(wView) => {this.wView = wView}}
     javaScriptEnabled={true}
     // onBridgeMessage={this.onBridgeMessage}
     onMessage={this.onMessage}
     injectedJavaScript="window.postMessage = String(Object.hasOwnProperty).replace('hasOwnProperty', 'postMessage');"               
     automaticallyAdjustContentInsets={false}
     domStorageEnabled={true}
     startInLoadingState={true}
     source={mainHtml} <-- load with, var mainHtml = require('./MainHtml.html');
     style={{width: 320,height:100,flex: 1}}/>
环境

react本机cli:2.0.1

反应本机:0.43.4

反应:16.0.0-alpha.6

泽福涅魔鬼酒店

Android版本6.0.1

据我所知,这是Android在版本中部署时的一个已知问题。解决方法是指向具有uri的文件:


那么,它是从项目文件夹的根目录开始的吗?谢谢,现在可以工作了。。我所做的是,在android\app\src\main\assets中创建assets文件夹,并将所有HTML文件放在那里,然后使用source={{uri:'引用它file:///android_asset/.html' }}
{ uri: 'file:///pathto/file.html' }