Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execution failed for task ':app:checkDebugAarMetadata'. #48137

Closed
Syedanas007 opened this issue Dec 6, 2024 · 2 comments
Closed

Execution failed for task ':app:checkDebugAarMetadata'. #48137

Syedanas007 opened this issue Dec 6, 2024 · 2 comments

Comments

@Syedanas007
Copy link

Description

Could not find com.facebook.react:react-native:0.76.3.
Searched in the following locations:

  • file:/D:/Test Env/EnforceSolution-Mobile_Tester/node_modules/react-native/android/com/facebook/react/react-native/0.76.3/react-native-0.76.3.pom
    If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
    Required by:
    project :app

Steps to reproduce

1.Npm Install
2.Npm Run android

React Native Version

0.76.3

Affected Platforms

Runtime - Android

Output of npx react-native info

System:
  OS: Windows 11 10.0.26100
  CPU: (12) x64 12th Gen Intel(R) Core(TM) i5-1235U
  Memory: 1.95 GB / 15.69 GB
Binaries:
  Node:
    version: 18.20.4
    path: C:\Program Files\nodejs\node.EXE
  Yarn: Not Found
  npm:
    version: 10.7.0
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK:
    AllowAllTrustedApps: Disabled
    Versions:
      - 10.0.17763.0
      - 10.0.19041.0
IDEs:
  Android Studio: AI-223.8836.35.2231.10406996
  Visual Studio:
    - 16.11.34301.259 (Visual Studio Community 2019)
Languages:
  Java: 17.0.12
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli":
    installed: 16.0.0
    wanted: ^16.0.0
  "@react-native/monorepo":
    installed: 1000.0.0
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native: Not Found
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs

> Task :app:checkDebugAarMetadata FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5/userguide/command_line_interface.html#sec:command_line_warnings
2 actionable tasks: 1 executed, 1 up-to-date

info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.facebook.react:react-native:0.76.3.
     Searched in the following locations:
       - file:/D:/Test Env/EnforceSolution-Mobile_Tester/node_modules/react-native/android/com/facebook/react/react-native/0.76.3/react-native-0.76.3.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :app

* 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 5s
error Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:checkDebugAarMetadata'. > Could not resolve all files for configuration ':app:debugRuntimeClasspath'. > Could not find com.facebook.react:react-native:0.76.3. Searched in the following locations: - file:/D:/Test Env/EnforceSolution-Mobile_Tester/node_modules/react-native/android/com/facebook/react/react-native/0.76.3/react-native-0.76.3.pom If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration. Required by: project :app * 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 5s.
info Run CLI with --verbose flag for more details.

Reproducer

https://github.com/Syedanas007/EnforceApp

Screenshots and Videos

Android/app/Bulid.gradle

apply plugin: "com.android.application"
apply plugin: "com.google.gms.google-services"
apply plugin: "org.jetbrains.kotlin.android"
// apply plugin: "com.facebook.react" // New React Native plugin system

import com.android.build.OutputFile

// Configuration for React Native tasks
project.ext.react = [
enableHermes: true, // clean and rebuild if changing
bundleInStagingRelease: true, //include JS bundle in staging builds
devDisabledInStagingRelease: true //disable DEV mode in staging builds/ Ensure Hermes is enabled
]

// def enableHermes = project.ext.react.get("enableHermes", false)
// apply from: "../../node_modules/react-native/react.gradle"

android {
compileSdkVersion rootProject.ext.compileSdkVersion // Set to your compile SDK version
namespace "com.enforcesolutions" // Ensure namespace matches applicationId

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17 // Targeting Java 17
}

kotlinOptions {
jvmTarget = "17" // Targeting JVM 17 for Kotlin
}

// JVM Toolchain configuration for Java 17
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

tasks.withType(JavaCompile) {
options.release = 17
}
// stagingRelease {
// initWith release
// signingConfig signingConfigs.debug
// applicationIdSuffix ".staging"
// matchingFallbacks = ['release']
// }

// tasks.named('compileDebugJavaWithJavac') {
// dependsOn ':@react-native-community_geolocation:compileDebugAidl'
// dependsOn ':@react-native-community_geolocation:generateDebugBuildConfig'
// // Add any other dependencies you need to ensure they execute in the correct order
// }

defaultConfig {
applicationId "com.enforcesolutions" // Must match the namespace
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 7
versionName "2.0"
multiDexEnabled true // Enabling multidex for large apps
missingDimensionStrategy 'react-native-camera', 'mlkit' // Example strategy
}

splits {
abi {
reset()
enable true // Disable ABI splitting (set to true if necessary)
universalApk false
include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' // Architectures to support
}
}

signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
release {
storeFile file('new-debug.keystore')
storePassword '12345678' // Use your actual passwords
keyAlias 'key0'
keyPassword '12345678'
}
}

buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {

    shrinkResources true  // Shrinks unused resources in release builds
    minifyEnabled true  // Enable Proguard to minify the code
    crunchPngs false
    signingConfig signingConfigs.release
    proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}

}

// ABI version codes for different CPU architectures
applicationVariants.all { variant ->
variant.outputs.each { output ->
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) {
output.versionCodeOverride = versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}

dependencies {
// implementation project(':react-native-svg') // React Native SVG
// implementation project(':react-native-vector-icons') // Vector icons support
// implementation project(':react-native-geolocation-service') // Geolocation support
implementation fileTree(dir: "libs", include: ["*.jar"]) // Include local JARs
implementation "com.google.android.gms:play-services-base:17.0.0"
implementation 'com.google.android.gms:play-services-location:17.1.0'
implementation platform('org.jetbrains.kotlin:kotlin-bom:1.8.0')
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.8.0'
implementation 'androidx.appcompat:appcompat:1.2.0' // Or the latest version

// implementation project(path: ':react-native-gesture-handler') // Gesture handler for React Native

// Facebook dependencies for React Native
implementation "com.facebook.react:react-native:0.76.3" // Replace with your version
implementation 'com.facebook.fbjni:fbjni-java-only:0.7.0' // fbjni for native Java-C++ bridge

// Hermes engine setup for optimized JavaScript execution
if (hermesEnabled) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation 'org.webkit:android-jsc:+' // Using JavaScriptCore instead of Hermes
}

// Multidex support for apps with over 64k methods
implementation 'androidx.multidex:multidex:2.0.1'

// Optional: Add Flipper for debugging
// debugImplementation 'com.facebook.flipper:flipper:0.125.0'
// debugImplementation 'com.facebook.flipper:flipper-network-plugin:0.125.0'
// debugImplementation 'com.facebook.flipper:flipper-fresco-plugin:0.125.0'
}

Android/Bulid.gradle

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

buildscript {
ext {
buildToolsVersion = "34.0.0" // Latest build tools version
minSdkVersion = 21
compileSdkVersion = 34
targetSdkVersion = 34
kotlin_version = '1.8.0'
}
repositories {
google()
jcenter()
mavenLocal()
mavenCentral()
maven { url 'https://jitpack.io/' }
maven { url 'https://maven.google.com/' }// Use mavenCentral as jcenter is deprecated
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2' // Compatible with Gradle 7.6
classpath 'com.google.gms:google-services:4.3.15' // Latest Google services plugin
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // Correct Kotlin plugin version
}
}

allprojects {
repositories {
mavenLocal()

// Exclusive content for resolving React Native dependencies
exclusiveContent {
    filter {
        includeGroup "com.facebook.react"
    }
    forRepository {
        maven {
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}

maven {
    // Android JSC is installed from npm
    url("$rootDir/../node_modules/jsc-android/dist")
}

google()
jcenter()
mavenCentral() 
    maven { url 'https://jitpack.io' }
    maven { url 'https://maven.google.com' }// Recommended instead of jcenter()

    }

}

configurations {
all*.exclude module: 'fbjni-java-only' // Exclude fbjni-java-only globally
}

package.json

{
"name": "EnForce",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest --detectOpenHandles",
"prettier-fix": "prettier --write '/*.{js,jsx,ts,tsx,json}'",
"prettier-check": "prettier --check '/.{js,jsx,ts,tsx,json}'",
"lint-fix": "eslint --fix .",
"lint-check": "eslint .",
"rename": "react-native-rename",
"postinstall": "npx jetify"
},
"dependencies": {
"@react-native-async-storage/async-storage": "^2.1.0",
"@react-native-community/datetimepicker": "^8.2.0",
"@react-native-community/geolocation": "^3.4.0",
"@react-native-community/masked-view": "^0.1.11",
"@react-native-community/netinfo": "^11.4.1",
"@react-navigation/drawer": "^7.0.19",
"@react-navigation/native": "^7.0.13",
"@react-navigation/stack": "^6.0.0",
"aws-amplify": "^5.0.0",
"aws-amplify-react-native": "^7.0.8",
"axios": "^1.7.9",
"enzyme": "^3.11.0",
"geolib": "^3.3.4",
"haversine": "^1.1.1",
"hermes-engine": "^0.11.0",
"i18n-js": "^4.5.0",
"lodash": "^4.17.21",
"moment": "^2.30.1",
"prop-types": "^15.8.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-native": "0.76.3",
"react-native-background-timer": "^2.4.1",
"react-native-camera": "^4.2.1",
"react-native-camera-hooks": "^0.5.3",
"react-native-circular-progress": "^1.4.1",
"react-native-country-picker-modal": "^2.0.0",
"react-native-dropdown-picker": "^5.4.6",
"react-native-exception-handler": "^2.10.10",
"react-native-fs": "^2.20.0",
"react-native-geocoding": "^0.5.0",
"react-native-geolocation-service": "^5.3.1",
"react-native-gesture-handler": "^2.21.2",
"react-native-image-crop-picker": "^0.41.6",
"react-native-indicators": "^0.17.0",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-linear-gradient": "^2.8.3",
"react-native-localize": "^3.3.0",
"react-native-maps": "1.20.1",
"react-native-material-dropdown": "^0.11.1",
"react-native-material-tabs": "^4.2.0",
"react-native-modalize": "^2.1.1",
"react-native-paper": "^5.12.5",
"react-native-permissions": "^5.2.1",
"react-native-progress": "^5.0.1",
"react-native-reanimated": "^3.16.3",
"react-native-restart": "0.0.27",
"react-native-safe-area-context": "^4.14.0",
"react-native-screens": "^4.3.0",
"react-native-segmented-control-tab": "^4.0.0",
"react-native-simple-toast": "^3.3.1",
"react-native-svg": "^15.10.1",
"react-native-uuid-generator": "^6.1.1",
"react-native-vector-icons": "^10.2.0",
"react-native-web": "^0.19.13",
"react-navigation": "^5.0.0",
"react-redux": "^9.1.2",
"redux": "^5.0.1",
"redux-persist": "^6.0.0",
"redux-saga": "^1.3.0",
"reduxsauce": "^1.3.0",
"rn-fetch-blob": "^0.12.0",
"uuid": "^11.0.3"
},
"devDependencies": {
"@babel/core": "^7.26.0",
"@babel/runtime": "^7.26.0",
"@cfaester/enzyme-adapter-react-18": "^0.8.0",
"@react-native-community/cli": "^16.0.0",
"@react-native-community/eslint-config": "^0.0.5",
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^29.7.0",
"eslint": "^8.57.1",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-native": "^4.1.0",
"eslint-plugin-standard": "^5.0.0",
"jest": "^29.7.0",
"jetifier": "^2.0.0",
"metro-react-native-babel-preset": "^0.77.0",
"prettier": "^3.4.2",
"react-native-codegen": "^0.70.7",
"react-native-rename": "^3.2.14",
"react-test-renderer": "18.3.1"
},
"jest": {
"preset": "react-native",
"setupFiles": [
"./node_modules/react-native-gesture-handler/jestSetup.js"
],
"transformIgnorePatterns": [
"node_modules/(?!((jest-)?react-native(-.)?|https://github.com/react-native(-community)?)/)"
]
}
}

@migueldaipre
Copy link
Collaborator

Hey @Syedanas007,

Please add a valid reproducer. The repro in the link is version v0.65 (out of the support window)

@cortinico
Copy link
Contributor

Duplicates #48116

@cortinico cortinico closed this as not planned Won't fix, can't repro, duplicate, stale Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants