Cannot resolve external dependency com.android.tools.build:gradle:2.3.0 because no repositories are defined

16 hours ago 1
ARTICLE AD BOX

I am creating an Github workflow for Android I am running the following commands

rm -rf node_modules npm install --verbose ( I am using Nexus Proxy created for NPM) npx --yes expo prebuild --skip-dependency-update react,react-dom,react-native npx --yes react-native-asset npx instrumentDynatrace

I am stuck with the following error

Configure project :notifee_react-native :notifee_react-native @notifee/react-native found at /home/runner/_work/app/node_modules/@notifee/react-native :notifee_react-native package.json found at /home/runner/_work/app/node_modules/@notifee/react-native/package.json :notifee_react-native:version set from package.json: 9.1.8 (9,1,8 - 9001008) :notifee_react-native:android.compileSdk using custom value: 34 :notifee_react-native:android.targetSdk using custom value: 34 :notifee_react-native:android.minSdk using custom value: 23 :notifee_react-native:reactNativeAndroidDir /home/runner/_work/app/node_modules/react-native/android FAILURE: Build failed with an exception.

What went wrong: A problem occurred configuring project ':react-native-android-keyboard-adjust-originallyus'.

Could not resolve all dependencies for configuration ':react-native-android-keyboard-adjust-originallyus:classpath'. Cannot resolve external dependency com.android.tools.build:gradle:2.3.0 because no repositories are defined. Required by: project :react-native-android-keyboard-adjust-originallyus

My android/build.gradle file

// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() mavenCentral() } apply from: "../node_modules/@dynatrace/react-native-plugin/files/plugin.gradle", to: buildscript ext { buildToolsVersion = findProperty('android.buildToolsVersion') ?: '34.0.0' minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '31') compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '34') targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '34') kotlinVersion = findProperty('android.kotlinVersion') ?: '1.9.23' ndkVersion = "26.1.10909125" } dependencies { classpath 'com.google.gms:google-services:4.4.1' classpath('com.android.tools.build:gradle') classpath('com.facebook.react:react-native-gradle-plugin') classpath('org.jetbrains.kotlin:kotlin-gradle-plugin') } } apply from: "../node_modules/@dynatrace/react-native-plugin/files/dynatrace.gradle" apply plugin: "com.facebook.react.rootproject" allprojects { repositories { google() mavenCentral() maven { url 'https://www.jitpack.io' } 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')) } } }

In my android/app/build.gradle i don't have the below section

buildscript { repositories { google() mavenCentral() }

Tools Info:

Node.js version : 20.0.0 NPM: 10.8.2 Expo-CLI : 6.3.12 Java : 17 Androdid commandlinetools : commandlinetools-linux-14742923_latest.zip OS: Ubuntu
Read Entire Article