question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Task :react-native-webview:compileDebugJavaWithJavac FAILED

See original GitHub issue


import React, { Component } from 'react';
import { View } from 'react-native';
import { WebView } from 'react-native-webview';

export default class App extends Component {
  render() {
    return (
      <View style={{ flex: 1 }}>
        <WebView source={{ uri: 'https://www.baidu.com' }} />
      </View>
    );
  }
}


yarn add react-native-webview

yarn android


have a problem

Task :react-native-webview:compileDebugJavaWithJavac FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use ‘–warning-mode all’ to show the individual deprecation warnings. See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings 16 actionable tasks: 16 executed E:\react-native-pro\test\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewModule.java:276: � ���: �Ҳ������� if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { ^ ����: ���� Q λ��: �� VERSION_CODES ע: E:\react-native-pro\test\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.javaʹ� û�����ѹ�ʱ�� API�� ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:deprecation ���±��롣 ע: E:\react-native-pro\test\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.javaʹ� ���δ�������ȫ�IJ����� ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:unchecked ���±��롣 1 ������

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:react-native-webview:compileDebugJavaWithJavac’.

Compilation failed; see the compiler error output for details.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 34s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 E:\react-native-pro\test\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewModule.java:276: � ���: �Ҳ������� if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { ^ ����: ���� Q λ��: �� VERSION_CODES ע: E:\react-native-pro\test\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.javaʹ� û�����ѹ�ʱ�� API�� ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:deprecation ���±��롣 ע: E:\react-native-pro\test\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.javaʹ� ���δ�������ȫ�IJ����� ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:unchecked ���±��롣 1 ������

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:react-native-webview:compileDebugJavaWithJavac’.

Compilation failed; see the compiler error output for details.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 34s

at makeError (E:\react-native-pro\test\node_modules\execa\index.js:174:9)
at E:\react-native-pro\test\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async runOnAllDevices (E:\react-native-pro\test\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (E:\react-native-pro\test\node_modules\@react-native-community\cli\build\index.js:186:9)

error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:15
  • Comments:20

github_iconTop GitHub Comments

79reactions
vladrozhnevcommented, Jun 6, 2020

@vervin I have a solution.

  1. Open the build.gradle file in the android folder (${workspace}/android/build.gradle).
  2. Change compileSdkVersion to 29 in the buildscript > ext section.
9reactions
wiredmatrixcommented, May 21, 2021

In my case, I installed react-native-webview 11.4.6 in my android/build.gradle I have the following: buildToolsVersion = “30.0.0” minSdkVersion = 21 compileSdkVersion = 30 targetSdkVersion = 30 ndkVersion = “23.0.7272597”

my complieSdkVersion and targetSdkVersion are 30 because expo-permission requires it to be 30, but all the solution am seeing for the react-native-webview is to make complieSdkVersion and targetSdkVersion to 29. How do I solve my issue? Any help is appreciated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Execution failed for task ':app:compileDebugJavaWithJavac ...
This error occur because you RN version is different from Android's build.gradle version. When you create a react-native app probably it ...
Read more >
Execution failed for task ':app:compileDebugJavaWithJavac ...
When i try to run "react-native run-android" command i get build failed with error Execution failed for task ':app:compileDebugJavaWithJavac'.
Read more >
task :react-native-webview:compiledebugjavawithjavac failed ...
task :react-native-webview:compiledebugjavawithjavac failed · 1.) Detect button click from WebView in React Native · 2.) Adding ReactJS in android Webview · 3.) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found