我正在尝试使用https://github.com/react-native-community/react-native-webview。
我得到这个错误时,我尝试和react-native run-android
,有什么想法,我可以使用webview?
**\node_modules\react-native-webview\android\src\main\java\com\react-native社区\网络视图\RNCWebViewManager.java:54:404-页面com.reactnativecommunity.webview.events不存在页面不存在.
使用:
React Native客户端:2.0.1自然React:0.57.1
完整错误:
Task :react-native-webview:compileDebugJavaWithJavac C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:54: error: package com.reactnativecommunity.webview.events does not exist import com.reactnativecommunity.webview.events.TopLoadingErrorEvent; ^ C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:55: error: package com.reactnativecommunity.webview.events does not exist import com.reactnativecommunity.webview.events.TopLoadingFinishEvent; ^ C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:56: error: package com.reactnativecommunity.webview.events does not exist import com.reactnativecommunity.webview.events.TopLoadingProgressEvent; ^ C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:57: error: package com.reactnativecommunity.webview.events does not exist import com.reactnativecommunity.webview.events.TopLoadingStartEvent; ^ C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:58: error: package com.reactnativecommunity.webview.events does not exist import com.reactnativecommunity.webview.events.TopMessageEvent; ^ C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:59: error: package com.reactnativecommunity.webview.events does not exist import com.reactnativecommunity.webview.events.TopShouldStartLoadWithRequestEvent; ^ C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:455: error: cannot find symbol export.put(TopLoadingProgressEvent.EVENT_NAME, MapBuilder.of("registrationName", "onLoadingProgress")); ^ symbol: variable TopLoadingProgressEvent location: class RNCWebViewManager C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:456: error: cannot find symbol export.put(TopShouldStartLoadWithRequestEvent.EVENT_NAME, MapBuilder.of("registrationName", "onShouldStartLoadWithRequest")); ^ symbol: variable TopShouldStartLoadWithRequestEvent location: class RNCWebViewManager C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:457: error: method getJSEventName in enum ScrollEventType cannot be applied to given types; export.put(ScrollEventType.getJSEventName(ScrollEventType.SCROLL), MapBuilder.of("registrationName", "onScroll")); ^ required: no arguments found: ScrollEventType reason: actual and formal argument lists differ in length C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:732: error: cannot find symbol new TopLoadingProgressEvent( ^ symbol: class TopLoadingProgressEvent location: class RNCWebChromeClient C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:617: error: cannot find symbol new TopLoadingStartEvent( ^ symbol: class TopLoadingStartEvent location: class RNCWebViewClient C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:626: error: cannot find symbol new TopShouldStartLoadWithRequestEvent( ^ symbol: class TopShouldStartLoadWithRequestEvent location: class RNCWebViewClient C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:659: error: cannot find symbol new TopLoadingErrorEvent(webView.getId(), eventData)); ^ symbol: class TopLoadingErrorEvent location: class RNCWebViewClient C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:665: error: cannot find symbol new TopLoadingFinishEvent( ^ symbol: class TopLoadingFinishEvent location: class RNCWebViewClient C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java:901: error: cannot find symbol dispatchEvent(this, new TopMessageEvent(this.getId(), message)); ^ symbol: class TopMessageEvent location: class RNCWebView Note: C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: C:\Users\Matt\sites\tcapp\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 15 errors
任务:React-本机-Web视图:编译调试JavaWithJavac失败
2条答案
按热度按时间h7appiyu1#
这个问题发生在我身上
我有这些版本的react-native和
react-native-webview
版本我以前版本的项目一切都很好,这个版本没有发生任何事情。
在更新android-studio和升级gradle之后,我重新构建并运行了同一个项目(在我从github repo克隆了同一个项目之后)。出现了这个问题,然后我放置并检查了
react-native-webview
的每个新版本(5.12.1以上)。最后,它匹配,修复了错误,并成功地使用此版本构建了应用。8yparm6h2#
1.单击node_modules文件夹
1.删除react-native-webview文件夹
安装最新版本
npm i react-native-webview