react-native-webview: [ANDROID] react-native-webview:compileDebugJavaWithJavac BUILD ERROR on 10.2.1
Bug description: Hello, just upgraded to 10.2.1 from 9.4.
I am getting following two errors when building android.
.../node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java:1239: error: method setWebChromeClient(WebChromeClient) is already defined in class RNCWebView
public void setWebChromeClient(WebChromeClient client) {
^
.../node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewModule.java:276: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
^
symbol: variable Q
location: class VERSION_CODES
I have done ./gradlew clean and reset npm cache, but same result.
Environment:
- OS: MacOS
- OS version: 10.15.5
- react-native version: 0.61.5
- react-native-webview version: 10.2.1
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 17
- Comments: 21 (7 by maintainers)
@Jncls you must change your project to at least compile SDK target 29, usually it’s in the
extblock ofandroid/build.gradleit brings in the new symbols but crucially will not alter how the platform or Google view your app for review or execution purposes so it is not a major change (as opposed to changing your target SDK - that needs careful consideration)
This was a breaking change for library consumers and was regrettably not marked as such, sorry for the trouble
My solution is change compile SDK target 29 in path
android/build.gradleThe beauty of pushing stuff out of the core… 😑
@antonkalik If you’ve done this
and it still doesn’t work, even after making sure you have a clean build environment, then your project has some specific issue that defies everything I know about Java, Android SDKs, and gradle 🤷
Thanks for the help. Yes that is the issue with the 10.2.0 version and up and they dont seem to fix them.
Same issue here using version 10.2.3:
node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewModule.java:276: error: cannot find symbol if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { ^ symbol: variable Q location: class VERSION_CODESAnd so it goes
@mikehardy It wasn’t meant as a snarky comment, but as a sincere concern. As part of the Lean Core initiative, more and more features that are not considered ‘core’ functionality are being pushed out to community packages. The project I’m working on uses at least 4 of those by now, which are critical to our app, and used to be part of the core, and we’ve honestly seen a dramatic increase in issues with newly released versions of those community packages across the board. Semver violations, poor testing, regression issues. And no, right now I do not have the time to submit a PR, I’m sorry.