skip to Main Content

I am trying to create build using Gradle.

So at Android folder as "./gradlew assembleDebug –stacktrace" command is executed it completed configuration 100% and while executing at 54% it says:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':expo-permissions:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction

this is my build.gradle file

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = '29.0.3'
        minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '23')
        compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '34')
        targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '34')
        kotlinVersion = '1.9.0'
        // kotlinVersion = findProperty('android.kotlinVersion') ?: '1.9.23'

        ndkVersion = "27.0.12077973"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath('com.android.tools.build:gradle')
        classpath('com.facebook.react:react-native-gradle-plugin')
        // Use the correct property name
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
    }
}

apply plugin: "com.facebook.react.rootproject"

allprojects {
    repositories {
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url(new File(['node', '--print', "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), '../android'))
        }
        maven {
            // Android JSC is installed from npm
            url(new File(['node', '--print', "require.resolve('jsc-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), '../dist'))
        }

        google()
        mavenCentral()
        maven { url 'https://www.jitpack.io' }
    }
}

this is my package.json file

{
  "name": "my-app",
  "main": "expo-router/entry",
  "version": "1.0.0",
  "scripts": {
    "start": "expo start",
    "reset-project": "node ./scripts/reset-project.js",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web",
    "test": "jest --watchAll"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@expo-google-fonts/poppins": "^0.2.3",
    "@expo/vector-icons": "^14.0.2",
    "@react-native-async-storage/async-storage": "1.23.1",
    "@react-native-community/datetimepicker": "8.0.1",
    "@react-native-firebase/app": "^20.4.0",
    "@react-native-firebase/messaging": "^20.4.0",
    "@react-navigation/drawer": "^6.7.2",
    "@react-navigation/native": "^6.1.18",
    "@react-navigation/stack": "^6.4.1",
    "@react-navigation/tabs": "^0.0.0-alpha.12",
    "axios": "^1.7.3",
    "date-fns": "^3.6.0",
    "expo": "^51.0.26",
    "expo-av": "^14.0.6",
    "expo-constants": "~16.0.2",
    "expo-device": "^6.0.2",
    "expo-font": "~12.0.9",
    "expo-image-picker": "~15.0.7",
    "expo-linking": "~6.3.1",
    "expo-notifications": "^0.28.15",
    "expo-permissions": "^14.4.0",
    "expo-router": "^3.5.21",
    "expo-splash-screen": "~0.27.5",
    "expo-status-bar": "~1.12.1",
    "expo-system-ui": "~3.0.7",
    "expo-web-browser": "~13.0.3",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-hook-form": "^7.52.2",
    "react-native": "^0.74.5",
    "react-native-crypto-js": "^1.0.0",
    "react-native-element-dropdown": "^2.12.1",
    "react-native-gesture-handler": "~2.16.1",
    "react-native-pager-view": "6.3.0",
    "react-native-paper": "^5.12.5",
    "react-native-reanimated": "~3.10.1",
    "react-native-safe-area-context": "4.10.5",
    "react-native-screens": "3.31.1",
    "react-native-tab-view": "^3.5.2",
    "react-native-vector-icons": "^10.1.0",
    "react-native-web": "~0.19.10"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@types/jest": "^29.5.12",
    "@types/react": "~18.2.45",
    "@types/react-test-renderer": "^18.0.7",
    "jest": "^29.2.1",
    "jest-expo": "~51.0.3",
    "react-test-renderer": "18.2.0",
    "typescript": "~5.3.3"
  },
  "private": true
}

Trying to solve this error for two days not going anywhere

Want to create .apk file from react native expo.

2

Answers


  1. The problem is the “expo-permissions” package. I think you need to uninstall it and find another way to manage permissions.

    And normally you don’t need to use it anymore, since every expo module now integrates its own permission system.

    You can have a look at: expo-permissions

    Login or Signup to reply.
  2. I have experienced below error

    A problem occurred evaluating project ‘:expo-permissions’.
    Failed to apply plugin class ‘KotlinExpoModulesCorePlugin’.
    Could not find method android() for arguments [KotlinExpoModulesCorePlugin$_apply_closure4@150f033e] on project ‘:expo-permissions’ of type org.gradle.api.Project.

    The above answer has resovled the problem for me

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search