question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build from source fails at, could not find ANDROID_NDK_VERSION

See original GitHub issue

Description

I am trying to build from source, and it seems I have set up everything correctly but the build still fails.with the following error. Any help would be appreciated

❯ ./gradlew clean

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/ashish/projects/tarana/node_modules/react-native/ReactAndroid/build.gradle' line: 450

* What went wrong:
A problem occurred evaluating project ':ReactAndroid'.
> Could not get unknown property 'ANDROID_NDK_VERSION' for extension 'android' of type com.android.build.gradle.LibraryExtension.

* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 6s

Version

0.67.2

Output of npx react-native info

❯ npx react-native info
warn Package lint-staged has been ignored because it contains invalid configuration. Reason: Package subpath './package.json' is not defined by "exports" in /Users/ashish/projects/tarana/node_modules/lint-staged/package.json
info Fetching system and libraries information...
System:
    OS: macOS 11.6.1
    CPU: (8) x64 Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
    Memory: 515.24 MB / 20.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 12.22.10 - ~/n/bin/node
    Yarn: 1.22.11 - ~/n/bin/yarn
    npm: 6.14.16 - ~/n/bin/npm
    Watchman: 2022.01.03.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.2 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
    Android SDK:
      API Levels: 28, 29, 30, 31, 32
      Build Tools: 28.0.3, 29.0.2, 30.0.2, 31.0.0, 32.0.0, 32.1.0
      System Images: android-29 | Google APIs Intel x86 Atom
      Android NDK: 21.4.7075529
  IDEs:
    Android Studio: 2020.3 AI-203.7717.56.2031.7935034
    Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.11 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: Not Found
    react-native: Not Found
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

I ran ./gradlew clean and it appeared

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

Not available

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:23 (8 by maintainers)

github_iconTop GitHub Comments

16reactions
SeanDunfordcommented, Apr 19, 2022

Was experiencing a similar issue after upgrading to react-native@0.68.1

The proposed addition to settings.gradle did not help:

includeBuild('../node_modules/react-native/packages/react-native-gradle-plugin') {
   dependencySubstitution {
       substitute(module("com.facebook.react:react-native-gradle-plugin")).using(project(":"))
   }
}

but using the following line

includeBuild('../node_modules/react-native-gradle-plugin')

image

from the upgrade guide did help. https://react-native-community.github.io/upgrade-helper/?from=0.67.4&to=0.68.1

11reactions
cortinicocommented, Feb 8, 2022

A problem occurred configuring root project ‘tarana’.

Could not resolve all artifacts for configuration ‘:classpath’. Could not find com.facebook.react:react-native-gradle-plugin:.

The fix for this specific issue is to update your settings.gradle as follows:

-includeBuild('../node_modules/react-native/packages/react-native-gradle-plugin')
+includeBuild('../node_modules/react-native/packages/react-native-gradle-plugin') {
+   dependencySubstitution {
+       substitute(module("com.facebook.react:react-native-gradle-plugin")).using(project(":"))
+   }
+}

The problem is that you’re using an older revision of the repo, therefore the wiki is updated to use the latest main. Building from source from different revision is generally not supported (i.e. you’re on your own) as there are those kinds of incompatibilities, and we can’t provide instructions for all the possible RN versions/branches.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NDK is not configured issue in android studio - Stack Overflow
First for NDK not Configured problem ... Then for the Next Problem or Error. ... Go to Android SDK > SDK Tools Check...
Read more >
Install and configure the NDK and CMake - Android Developers
This page describes how to install these components automatically, or by using Android Studio or the sdkmanager tool to download and install them...
Read more >
Github action flows fails: NDK is not installed #46
I know that I'm using com.android.tools.build:gradle:4.1.0 but I couldn't find the source for this version online. I'm also ...
Read more >
How to use ndkVersion in gradle - Google Groups
A problem occurred evaluating project ':cmakelib'. > Could not find method ndkVersion() for arguments [20.0.5594570] on object of type com.android.build.gradle.
Read more >
Android - Qt Wiki
These are building instructions for building Qt for Android on Linux ... failed to start because it could not find or load the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found