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

Native React - VS Studio Code - npm run android - Execution failed for task ':app:checkDebugAarMetadata' #41310

Closed
yuezonglun opened this issue Nov 3, 2023 · 6 comments
Labels
Platform: Android Android applications. Resolution: Answered When the issue is resolved with a simple answer

Comments

@yuezonglun
Copy link

Description

I have been getting this error when trying to run npm android build on my native react project. I have gone through the entire android setup along with updating Environment variables. The emulator works but the install fails with the following message:

`* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Failed to transform react-android-0.72.6-debug.aar (com.facebook.react:react-android:0.72.6) to match attributes {artifactType=android-aar-metadata, com.android.build.api.attributes.BuildTypeAttr=debug, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: /Users/yueyue/.gradle/caches/modules-2/files-2.1/com.facebook.react/react-android/0.72.6/2e2db118c9084b05c1a5d6079148bc983668f372/react-android-0.72.6-debug.aar.
> Java heap space`

build.gradle as follows:
`// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33

    kotlinVersion = "1.7.0"

    // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
    ndkVersion = "23.1.7779620"
}
repositories {
    google()
    mavenCentral()
    maven { url 'https://www.jitpack.io' }
}
dependencies {
    classpath("com.android.tools.build:gradle")
    classpath("com.facebook.react:react-native-gradle-plugin")
}

}

allprojects {
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
mavenCentral {
// We don't want to fetch react-native from Maven Central as there are
// older versions over there.
content {
excludeGroup "com.facebook.react"
}
}
google()
maven { url 'https://www.jitpack.io' }
maven {url 'https://dl.google.com/dl/android/maven2/'}
}
}
`
Please help.

React Native Version

0.72.6

Output of npx react-native info

npm WARN cli npm v10.2.2 does not support Node.js v16.17.0. This version of npm supports the following node versions: ^18.17.0 || >=20.5.0. You can find the latest version at https://nodejs.org/.
warn Package rn-fetch-blob contains invalid configuration: "dependency.hooks" is not allowed. Please verify it's properly linked using "react-native config" command and contact the package maintainers about this.
info Fetching system and libraries information...
System:
OS: macOS 14.1
CPU: (8) x64 Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
Memory: 111.47 MB / 8.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 16.17.0
path: ~/.nvm/versions/node/v16.17.0/bin/node
Yarn:
version: 1.22.19
path: /usr/local/bin/yarn
npm:
version: 10.2.2
path: ~/.nvm/versions/node/v16.17.0/bin/npm
Watchman: Not Found
Managers:
CocoaPods:
version: 1.12.1
path: /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.0
- iOS 17.0
- macOS 14.0
- tvOS 17.0
- watchOS 10.0
Android SDK:
API Levels:
- "23"
- "26"
- "28"
- "29"
- "30"
- "31"
- "33"
- "34"
Build Tools:
- 29.0.2
- 30.0.2
- 30.0.3
- 31.0.0
- 33.0.0
- 34.0.0
System Images:
- android-30 | Intel x86 Atom_64
- android-30 | Google APIs Intel x86 Atom
- android-33 | Google APIs Intel x86_64 Atom
Android NDK: Not Found
IDEs:
Android Studio: 2022.2 AI-222.4459.24.2221.10121639
Xcode:
version: 15.0.1/15A507
path: /usr/bin/xcodebuild
Languages:
Java:
version: 11.0.15
path: /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.6
wanted: 0.72.6
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false

Steps to reproduce

yarn android

Snack, code example, screenshot, or link to a repository

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

buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33

    kotlinVersion = "1.7.0"

    // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
    ndkVersion = "23.1.7779620"
}
repositories {
    google()
    mavenCentral()
    maven { url 'https://www.jitpack.io' }
}
dependencies {
    // implementation project(':jpush-react-native')  // 添加 jpush 依赖
    // implementation project(':jcore-react-native')  // 添加 jcore 依赖
    classpath("com.android.tools.build:gradle")
    classpath("com.facebook.react:react-native-gradle-plugin")
}

}

allprojects {
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
mavenCentral {
// We don't want to fetch react-native from Maven Central as there are
// older versions over there.
content {
excludeGroup "com.facebook.react"
}
}
google()
maven { url 'https://www.jitpack.io' }
maven {url 'https://dl.google.com/dl/android/maven2/'}
}
}
`

@yuezonglun yuezonglun added Needs: Triage 🔍 Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) labels Nov 3, 2023
@github-actions github-actions bot added the Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. label Nov 3, 2023
Copy link

github-actions bot commented Nov 3, 2023

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

@github-actions github-actions bot added the Platform: Android Android applications. label Nov 3, 2023
@12ya
Copy link

12ya commented Nov 4, 2023

Try to delete the app from your phone and build again

@yuezonglun
Copy link
Author

@12ya Deleted it, but still have this problem

@pekq
Copy link

pekq commented Nov 7, 2023

I was able to resolve by clearing caches using this awesome tool https://github.com/taboulot/rn-game-over

npx rn-game-over -a
npx rn-game-over -j

I first tried with built in clean tool (npx react-native clean) but it had no effect.

I encountered this bug when removing expo-dev-client package from the project.

@cortinico
Copy link
Contributor

Java heap space

This means you're running out of memory.
You can increase the max memory you're giving to the build process in your gradle.properties file:

org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m

@cortinico cortinico added Resolution: Answered When the issue is resolved with a simple answer and removed Needs: Triage 🔍 Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) labels Nov 22, 2023
@VNDRN
Copy link

VNDRN commented Dec 7, 2023

npx rn-game-over -a
npx rn-game-over -j

This and rebooting my device worked for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Android Android applications. Resolution: Answered When the issue is resolved with a simple answer
Projects
None yet
Development

No branches or pull requests

5 participants