react-native-webview: Android Studio cannot find symbol class RNCWebViewPackage
I tried @FaiChou’s fix to comment out RequireAPI, but am still receiving errors building with this package not being found by Android Studio even though it appears to be properly linked and exists within node_modules.
settings.gradle contains:
include ':react-native-webview' project(':react-native-webview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview/android')
MainApplication.java contains:
import com.reactnativecommunity.webview.RNCWebViewPackage;
npm 6.4.1 react-native 0.57.7 node 10.13.0
am I missing something?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 29 (1 by maintainers)
Commits related to this issue
- fix(gradle): Add support library as a dependency (#253) fixes #174 fixes #184 fixes #245 — committed to react-native-webview/react-native-webview by Titozzz 5 years ago
- chore(release): 3.1.3 [skip ci] ## [3.1.3](https://github.com/react-native-community/react-native-webview/compare/v3.1.2...v3.1.3) (2019-01-18) ### Bug Fixes * **gradle:** Add support library as a ... — committed to react-native-webview/react-native-webview by semantic-release-bot 5 years ago
- fix(gradle): Add support library as a dependency (#253) fixes #174 fixes #184 fixes #245 — committed to phuongwd/react-native-webview by Titozzz 5 years ago
- chore(release): 3.1.3 [skip ci] ## [3.1.3](https://github.com/react-native-community/react-native-webview/compare/v3.1.2...v3.1.3) (2019-01-18) ### Bug Fixes * **gradle:** Add support library as a ... — committed to phuongwd/react-native-webview by semantic-release-bot 5 years ago
- chore(release): 3.1.3 [skip ci] ## [3.1.3](https://github.com/react-native-community/react-native-webview/compare/v3.1.2...v3.1.3) (2019-01-18) ### Bug Fixes * **gradle:** Add support library as a ... — committed to noproblem23/react-native-webview by noproblem23 5 years ago
- chore(release): 1.0.0 [skip ci] # 1.0.0 (2023-09-13) ### Bug Fixes * **android:** add null reference check for onMessage on android ([#770](https://github.com/CodinDotTop/react-native-webview/issue... — committed to CodinDotTop/react-native-webview by semantic-release-bot 10 months ago
Totally i think they should add a manual installation in doc’s because sometime link command doesn’t work properly
in build.gradle of react-native-webview, update code.
i resolve this by adding
implementation 'com.android.support:support-annotations:28.0.0'in build.gradle of react-native-webviewNot to mention the doc seems a bit snarky about how you must have forgotten to run
linkwhen the same errors happen when link fails 👎Error is the one described in the issue
Cannot resolve symbol RNCWebViewPackageon
import com.reactnativecommunity.webview.RNCWebViewPackage;(MainApplication.java)This is coming soon guys, sorry about the current state of the repo, I’m trying 😍
@aschenkel add
compile project(':react-native-webview')to your app/build.gradle and also addto your settings.gradle
This is an okay fix but I think its not acceptable because now every developer needs to add the support-annotations dependency to this projects build.gradle file inside node_modules. Thats a whole lotta of unnecessary copy and paste, especially when you have to delete node_modules and run “npm i” again.
Maybe there should be a note somewhere reminding developers not to forget to add implementation ‘com.android.support:support-annotations:28.0.0’ inside “./node_modules/react-native-webview/build.gradle”
@AE0011 @charliewynn thanks!
compile project(':react-native-webview')was missing in myapp/build.gradleFor some reason
react-native-linkwas not doing it, but it was writing correctly onsettings.gradleA manual installation in doc’s would be useful
Should your build.gradle have
project(':react-native-webview')in its dependencies?Great, thank you so much.
Will come back to you soon after using the new version.
On Fri, 18 Jan 2019 at 21:13, Thibault Malbranche notifications@github.com wrote:
can you test installing like that and let me know if it’s fixed ?
yarn add react-native-webview@https://github.com/react-native-community/react-native-webview#1f11f10