androidreact-nativegradlewebviewreact-native-webview

Execution failed for task ':react-native-webview:compileDebugKotlin'


After upgrading react native from 0.61.2 to 0.68.2 with RN update helper, gradle cant build app. Getting this error

FAILURE: Build failed with an exception.

java.io.IOException: Permission denied

trying all react-native-webview versions but result is same.

when i removeing "react-native-webview": "^8.0.3" this line from package.json file then build successfully goes but app getting error because this dependency used in app

below dependency versions which i using.

  1. "react": "17.0.2",
  2. "react-native": "0.68.2",
  3. "@babel/core": "^7.12.9",
  4. "@babel/runtime": "^7.12.5",
  5. "@react-native-community/eslint-config": "^2.0.0",
  6. "babel-jest": "^26.6.3",
  7. "eslint": "^7.32.0",

distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-all.zip

android/build.gralde

buildscript {
    ext {
        buildToolsVersion = "31.0.0"
        minSdkVersion = 21
        compileSdkVersion = 31
        targetSdkVersion = 31
        if (System.properties['os.arch'] == "aarch64") {
            // For M1 Users we need to use the NDK 24 which added support for aarch64
            ndkVersion = "24.0.8215888"
        } else {
            // Otherwise we default to the side-by-side NDK version from AGP.
            ndkVersion = "21.4.7075529"
        }
    }

    dependencies {
    classpath("com.android.tools.build:gradle:7.0.4")
    classpath 'com.google.gms:google-services:4.3.8'
    classpath("com.facebook.react:react-native-gradle-plugin")
    classpath("de.undercouch:gradle-download-task:4.1.2")
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files

Solution

  • Try running this command on the android folder.

    sudo ./gradlew compileDebugKotlin

    This worked for me.