[FIXED] Android build failures `No matching variant of com.facebook.react:react-native:0.71.0-rc.0 was found.`
cortinico opened this issue Β· 220 comments
Description
Hey all,
I'd like to share an update on a series of build failures React Native & Expo users have been experiencing when building Android apps starting from November 4th 2022.
We'd like to apologize for the disruption this caused to your developer workflows. The React team is fully committed to delivering a smooth developer experience, and we take this type of issues extremely seriously.
π’ Patches for >= 0.63
We have prepared releases for all the main versions of react-native with an hotfix:
π³ 0.70.5: https://github.com/facebook/react-native/releases/tag/v0.70.5
π³οΈ 0.69.7: https://github.com/facebook/react-native/releases/tag/v0.69.7
π³ 0.68.5: https://github.com/facebook/react-native/releases/tag/v0.68.5
π³οΈ 0.67.5: https://github.com/facebook/react-native/releases/tag/v0.67.5
π³οΈ 0.66.5: https://github.com/facebook/react-native/releases/tag/v0.66.5
π³οΈ 0.65.3: https://github.com/facebook/react-native/releases/tag/v0.65.3
π³οΈ 0.64.4: https://github.com/facebook/react-native/releases/tag/v0.64.4
π³οΈ 0.63.5: https://github.com/facebook/react-native/releases/tag/v0.63.5
By updating to these patch versions, your Android build should start working again.
To do so, in your package.json
change react-native
's version to the relevant new patch (ex. if you are on 0.64.3, change to 0.64.4) and run yarn install
. No other changes should be necessary, but you might want to clean your android artifacts with a cd android && ./gradlew clean
before trying to re-run your Android app.
Fix for older react-native (< 0.63)
The fix above only works on gradle 6.2 and higher. Older react-native used older gradle.
You may determine your gradle version by looking in your /android/gradle/wrapper/gradle-wrapper.properties
file.
If you are on an older version of react-native (for example 0.63 or earlier) that uses gradle version 6.1 or below, you must use a different workaround as gradle 6.1 does not support exclusiveContent
.
Add this in the allprojects
area of your android/buld.gradle
file.
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())
allprojects {
configurations.all {
resolutionStrategy {
// Remove this override in 0.65+, as a proper fix is included in react-native itself.
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
}
}
Instead of using exclusiveContent
, the hotfix must force the version of React Native. The recommended hotfix shells out to node
to read your current version of react-native. If you hard code the version of react-native, when you upgrade your project in the future, your build will fail if you forget to remove this hotfix.
Note that this fix is fragile as the location of your package.json could be different if you are in a monorepo, and node might not be available if you use a node package manager like nvm.
Thank you @mikehardy for finding and providing this fix in your comment.
Technical Details
The issue
On November 4th 2022 we published the React Native version 0.71.0-rc0
, the first release candidate for the 71
release series, on several public repositories. Specifically, this version was also published on Maven Central as we're updating our artifacts distribution strategy (technical details are explained below).
This event resulted in build failures for Android on several users as they ended up downloading the wrong React Native version (0.71.0-rc0
instead of the version they were using in their project, say 0.68.0
).
The build error looks something like this:
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'My Project'.
Could not determine the dependencies of null.
Could not resolve all task dependencies for configuration ':classpath'.
> Could not resolve com.facebook.react:react-native:+.
Required by:
project :
> No matching variant of com.facebook.react:react-native:0.71.0-rc.0 was found.
The consumer was configured to find a runtime of a library compatible with Java 11,
packaged as a jar, and its dependencies declared externally, as well
as attribute 'org.gradle.plugin.api-version' with value '7.3.3' but:
Sadly, due to how older projects of React Native were created in the past, we couldn't simply re-publish older versions, and we're asking users to update their template using the fix suggested below.
Why this happened
Historically, the React Native template provided build.gradle
files that contain a dependency on the React Native Android library as follows: implementation("com.facebook.react:react-native:+")
.
Specifically, the +
part of this dependency declaration is causing Gradle to pick the highest version among all the declared repositories (often referred as Gradle Dynamic versions). Till React Native version 0.70
, we were shipping a Maven Repository inside the NPM package (inside the ./android
folder). Starting from 0.71
, we moved such folder and uploaded it to Maven Central.
Using Gradle Dynamic versions (i.e. a +
dependency) is considered an antipattern (see the various warnings and notes on this page), specifically as it can lead to scenarios like this one and generally exposes users to less-reproducible builds. This is exactly what happened in this scenario, as builds started failing without any changes to user projects.
In 0.71
we cleaned up the new app template and removed all the +
dependencies (see here) and we moved the template to use the React Native Gradle Plugin, which will allow us to prevent scenarios like this from happening in the future.
Sadly, users on older versions, say 0.66.0
, were still using a +
version. This caused their build to query all the repositories for the highest available versions of the React Native. While the node_modules/react-native/android
folder contained a valid 0.66.0
version, Gradle honoured the +
version and fetched version 0.71.0-rc0
from Maven Central as it's higher from the semantic versioning ordering.
The resolutionStrategy
block in the fix is forcing the version of com.facebook.react:react-native
to all the projects to the one provided by the version of React Native you're effectively using.
Who is affected?
All the React Native users on versions till 0.66.x
are affected.
React Native users on versions from 0.67
till 0.70
could be affected, based on which third-party library they're using.
We verified that empty projects created on versions from 0.67
till 0.70
are not affected.
However, some of your dependencies might end up causing a wrong resolution of the React Native Android library, resulting in build failures.
For instance, we verified that a project on React Native 0.68.4
works well with Reanimated 2.12.0
but fails with Reanimated 2.10.0
.
We also worked with Expo to make sure that users on eas build
received the aforementioned fix, so those users should not be affected.
Why React Native Android was published on Maven Central?
As mentioned, this was done as part of the implementation of the RFC #580.
The summary of that RFC is to allow us to overcome the limitation of NPM in terms of package size. Moving to Maven Central will allow us to reduce the build time for our users and distribute more granular artifacts which will end up benefitting the overall developer experience. We'll be able to share information on this in the near future.
In the initial Github Issue, several users suggest to remove the publishing from Maven Central or re-publish older artifacts to overcome the build failure without requesting a fix.
This is sadly not an option as:
- Maven Central is an immutable artifacts storage and doesn't allow deletion.
- The publishing on
0.71.0-rc0
was effectively correct. We believe this episode is essentially a "mis-configuration" in user projects, and we believe the better solution is to distribute this fix to our users.
How could this have been prevented
We were already aware of the risk of having Gradle dynamic dependencies, so since React Native 0.67
we introduced an exclude
rule on the Maven Central dependency inside the default template (see here for more context):
mavenCentral {
content {
excludeGroup("com.facebook.react")
}
}
React Native used to be published on Maven Central till version 0.20.1
(published in 2016). We had users in the past accidentally fetching older versions of React from Maven Central, causing their build to fail.
This exclude
directive assured that you won't ever download React Native from Maven Central. However, third party libraries could declare repositories inside their repositories{}
block which might not contain the exclude
directive, resulting in potentially broken dependency resolution.
React Native version 0.71.0
will ship with an updated template that relies on React Native Gradle Plugin. This new integration will allow us to protect us against future distributed build failures like this one, by allowing to re-distribute updated build logic across the whole ecosystem if needed (this should protect us also against similar outages like the JCenter outage happened last year).
I'd like to thank everyone for your patience and understanding and I'd like to call out some members our our community, specifically @mikehardy, @Titozzz, @brentvatne, @inckie and all the other folks involved in the initial investigation and fix for this issue.
We'll follow up with more updates in the future if needed.
Nicola
On behalf of the React team
I can confirm the fix works just fine with 0.70.3
My build issue started yesterday but the fix works for me
Thank you @cortinico this fix works ππ»
Thank you @cortinico, this fix works just fine with RN 0.63.2
Thanks @cortinico everything is working fine.
So once our projects updated to RN 0.71+ we must remove this workaround, right?
fix works on Rn v.0.64.2
@JodiRaina that likely indicates your gradle plugin or gradle is too old to use this advice - it appears gradle 6.1 and older does not have the exclusiveContent / include filter in the preferred solution.
If you cannot upgrade gradle (and react-native...), you might try one of the fallback workarounds for old react-native using very old gradle plugin / gradle, specifically this one, which was the best-known solution if exclusiveContent is not available / until the exclusiveContent idea occurred
@brentvatne @ Expo proposes this as a refinement to avoid the hard coded version, it is the same as the previous best-known solution but now with dynamic version powers, otherwise same idea - you put this in the allprojects area of your android/buld.gradle
file
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())
allprojects {
configurations.all {
resolutionStrategy {
// Remove this override in 0.66, as a proper fix is included in react-native itself.
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
}
}
Note that the exclusiveContent idea is a cleaner solution, but of course only if your gradle supports it
Thanks @cortinico.
I can confirm this fix working fine with react native 0.68.2 & 0.70.1
.
Thanks a lot @cortinico I am confirming about version 0.68.0
Hey everyone π ! We know the fix works in almost all cases.
We have one failure case where your gradle is 6.1 or lower, with a separate workaround as described above.
There is no need to report success here as it will just clutter up the thread and hide real problems, if any.
If you have a case that does not work, then it is worth commenting and pursuing.
Thanks!
I searched for 10 Hours for this Fix - pls provide this more publicly! It perfect fixes hours of searching why i got this error
A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
2 files found with path 'lib/armeabi-v7a/libfbjni.so' from inputs:
- C:\Users\Louis.gradle\caches\transforms-3\9fe0af513f6b028d441d24b0da4a585e\transformed\jetified-react-native-0.71.0-rc.0-release\jni
- C:\Users\Louis.gradle\caches\transforms-3\10cc45bff922d10dfa305b6219e85a22\transformed\jetified-fbjni-0.3.0\jni
If you are using jniLibs and CMake IMPORTED targets, see
@Libero793 the issue is pinned in this repository (at the top of the issues list), has been tweeted by a few people and is searchable. Please publicize it any other way you can if you feel it is missing publicity
@kaishuvam7 unfortunately, I think you may have some unrelated issue. Your stackoverflow does not in general meet stackoverflow guidelines: https://stackoverflow.com/help/how-to-ask / https://stackoverflow.com/help/minimal-reproducible-example so does not have the information required to help
Not working for the react-native: 0.64.2
I am having the same problem with this version 0.64.0.
I tried to figure it out but still can not figure out
I am having the same problem with this version 0.64.0. I tried to figure it out but still can not figure out
try this bro :
build.gradle
allprojects {
repositories {
exclusiveContent {
// We get React Native's Android binaries exclusively through npm,
// from a local Maven repo inside node_modules/react-native/.
// (The use of exclusiveContent prevents looking elsewhere like Maven Central
// and potentially getting a wrong version.)
filter {
includeGroup "com.facebook.react"
}
forRepository {
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
mavenCentral {
content {
excludeGroup("com.facebook.react")
}
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
then remove node modules, npm install, run gradlew clean in android directory, and run apps
Hi, after applying the fix the build in eas works correctly, but when running the application in production in android it crashes at startup. Does it happen to anyone else? any solution?
Hi, after applying the fix the build in eas works correctly, but when running the application in production in android it crashes at startup. Does it happen to anyone else? any solution?
+1.
in my case after digging around, it was looking for hermes.so file (which I don't use, disabled in the gradle file, and remove it after the build is done). And I still don't know how to fix it.
--------- beginning of crash
2022-11-06 11:39:26.214 8631-8696/*** E/AndroidRuntime: FATAL EXCEPTION: create_react_context
Process: ***, PID: 8631
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/***/lib-main flags = 1]
SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~-dS-qsYgLMRevGULTgeUdA==/***-ScQbcqeVLMVx2AtUh_jKrQ==/lib/x86 flags = 0]
SoSource 2: com.facebook.soloader.DirectorySoSource[root = /vendor/lib flags = 2]
SoSource 3: com.facebook.soloader.DirectorySoSource[root = /system/lib flags = 2]
Native lib dir: /data/app/~~-dS-qsYgLMRevGULTgeUdA==/***-ScQbcqeVLMVx2AtUh_jKrQ==/lib/x86
result: 0
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:918)
at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:740)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:654)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:634)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:582)
at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:20)
at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:29)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1054)
at java.lang.Thread.run(Thread.java:923)
Hi there, im still getting this error . Can anyone please help
Task :react-native-blob-util:verifyReleaseResources FAILED
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':react-native-blob-util:verifyReleaseResources'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
1 exception was raised by workers:
com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
/Users/brightsmac/.gradle/caches/transforms-2/files-2.1/62387f6979a345c65eb55946f8f1a3ff/core-1.7.0/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.
This is my package.json
{
"version": "5.0.6",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"@react-native-community/async-storage": "^1.12.0",
"@react-native-community/masked-view": "^0.1.10",
"@react-native-community/netinfo": "^5.9.7",
"@react-native-picker/picker": "^2.4.7",
"@redux-devtools/extension": "^3.2.3",
"moment": "^2.29.0",
"native-base": "^2.13.14",
"react": "16.13.1",
"react-native": "0.63.3",
"react-native-animatable": "^1.3.3",
"react-native-blob-util": "^0.15.0",
"react-native-device-info": "^8.7.1",
"react-native-draggable": "^3.3.0",
"react-native-element-dropdown": "^2.3.0",
"react-native-elements": "^3.4.2",
"react-native-fs": "^2.19.0",
"react-native-gesture-handler": "^1.8.0",
"react-native-image-picker": "^4.10.0",
"react-native-in-app-review": "^3.3.3",
"react-native-modalbox": "^2.0.2",
"react-native-pdf": "^6.5.0",
"react-native-progress": "^5.0.0",
"react-native-render-html": "^4.2.4",
"react-native-safe-area-context": "^3.1.8",
"react-native-screens": "^2.11.0",
"react-native-sqlite-storage": "^6.0.1",
"react-native-vector-icons": "^9.2.0",
"react-native-webview": "^11.23.1",
"react-navigation": "^4.4.1",
"react-navigation-stack": "^2.8.3",
"react-redux": "^7.2.1",
"redux": "^4.0.5"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/runtime": "^7.11.2",
"@react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.3.0",
"eslint": "^7.10.0",
"jest": "^26.4.2",
"metro-react-native-babel-preset": "^0.63.0",
"react-test-renderer": "16.13.1"
},
"jest": {
"preset": "react-native"
}
}
Hi,
I'm using react-native 0.67.2 in which the fix is already there.
However the error is caused by one of my dependencies "@react-native-async-storage/async-storage": "^1.16.1"
saying something about Java heap space.
Here is my error log
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-async-storage_async-storage:generateDebugRFile'.
> Could not resolve all files for configuration ':react-native-async-storage_async-storage:debugCompileClasspath'.
> Failed to transform react-native-0.71.0-rc.0-debug.aar (com.facebook.react:react-native:0.71.0-rc.0) to match attributes {artifactType=android-symbol-with-package-name, 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-api}.
> Execution failed for JetifyTransform: /home/optimusprime/.gradle/caches/modules-2/files-2.1/com.facebook.react/react-native/0.71.0-rc.0/7a7f5a0af6ebd8eb94f7e5f7495e9d9684b4f543/react-native-0.71.0-rc.0-debug.aar.
> Java heap space
* 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 8s
I checked the build.gradle
file of that dependency, which uses RN 0.66.0-0 which causes the above-mentioned error
Here is the build.gradle
file of @react-native-async-storage/async-storage
import java.nio.file.Paths
def resolveModulePath(packageName) {
def basePath = rootDir.toPath().normalize()
// Node's module resolution algorithm searches up to the root directory,
// after which the base path will be null
while (basePath) {
def candidatePath = Paths.get(basePath.toString(), 'node_modules', packageName)
if (candidatePath.toFile().exists()) {
return candidatePath.toString()
}
basePath = basePath.getParent()
}
return null
}
def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
def getFlagOrDefault(flagName, defaultValue) {
rootProject.hasProperty(flagName) ? rootProject.properties[flagName] == "true" : defaultValue
}
def getVersionOrDefault(String flagName, String defaultVersion) {
rootProject.hasProperty(flagName) ? rootProject.properties[flagName] : defaultVersion
}
configurations {
compileClasspath
}
buildscript {
// kotlin version is dictated by rootProject extension or property in gradle.properties
ext.asyncStorageKtVersion = rootProject.ext.has('kotlinVersion')
? rootProject.ext['kotlinVersion']
: rootProject.hasProperty('AsyncStorage_kotlinVersion')
? rootProject.properties['AsyncStorage_kotlinVersion']
: '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
if (project == rootProject) {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$asyncStorageKtVersion"
}
}
}
// AsyncStorage has default size of 6MB.
// This is a sane limit to protect the user from the app storing too much data in the database.
// This also protects the database from filling up the disk cache and becoming malformed.
// If you really need bigger size, please keep in mind the potential consequences.
long dbSizeInMB = 6L
def newDbSize = rootProject.properties['AsyncStorage_db_size_in_MB']
if (newDbSize != null && newDbSize.isLong()) {
dbSizeInMB = newDbSize.toLong()
}
// Instead of reusing AsyncTask thread pool, AsyncStorage can use its own executor
def useDedicatedExecutor = getFlagOrDefault('AsyncStorage_dedicatedExecutor', false)
// Use next storage implementation
def useNextStorage = getFlagOrDefault("AsyncStorage_useNextStorage", false)
apply plugin: 'com.android.library'
if (useNextStorage) {
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply from: './testresults.gradle'
}
android {
compileSdkVersion safeExtGet('compileSdkVersion', 31)
defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 21)
targetSdkVersion safeExtGet('targetSdkVersion', 31)
buildConfigField "Long", "AsyncStorage_db_size", "${dbSizeInMB}L"
buildConfigField "boolean", "AsyncStorage_useDedicatedExecutor", "${useDedicatedExecutor}"
buildConfigField "boolean", "AsyncStorage_useNextStorage", "${useNextStorage}"
}
lintOptions {
abortOnError false
}
if (useNextStorage) {
testOptions {
unitTests {
returnDefaultValues = true
includeAndroidResources = true
}
}
}
}
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "${resolveModulePath("react-native")}/android"
}
google()
mavenCentral()
}
dependencies {
if (useNextStorage) {
def room_version = getVersionOrDefault('AsyncStorage_next_roomVersion', '2.4.2')
def coroutines_version = "1.6.0"
def coroutinesTest_version = "1.6.0"
// if we don't provide explicit dependency on reflection, kotlin plugin
// would add one automatically, probably a version that is not compatible with
// used kotlin
def kotlinReflect_version = project.ext.asyncStorageKtVersion
def junit_version = "4.13.2"
def robolectric_version = "4.7.3"
def truth_version = "1.1.3"
def androidxtest_version = "1.4.0"
def androidtest_junit_version = "1.1.3"
implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.room:room-ktx:$room_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinReflect_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
kapt "androidx.room:room-compiler:$room_version"
testImplementation "junit:junit:$junit_version"
testImplementation "androidx.test:runner:$androidxtest_version"
testImplementation "androidx.test:rules:$androidxtest_version"
testImplementation "androidx.test.ext:junit:$androidtest_junit_version"
testImplementation "org.robolectric:robolectric:$robolectric_version"
testImplementation "com.google.truth:truth:$truth_version"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesTest_version"
}
//noinspection GradleDynamicVersion
implementation 'com.facebook.react:react-native:+' // From node_modules
}
Here is my android/build.gradle
file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "21.4.7075529"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.2")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
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' }
}
}
Even though my top level build.gradle
resolves RN locally, the dependencies are fetching from the maven.
I used version 0.62.2 for the same problem. Does anyone know how to solve it
@ankitagnihotri
I used version 0.62.2 for the same problem. Does anyone know how to solve it
I added it to the top-level gradle file
`// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
compileSdkVersion = 28
minSdkVersion = 21
targetSdkVersion = 28
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.6.4")
classpath 'com.yanzhenjie.andserver:plugin:2.1.10'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
**exclusiveContent {
// We get React Native's Android binaries exclusively through npm,
// from a local Maven repo inside node_modules/react-native/.
// (The use of exclusiveContent prevents looking elsewhere like Maven Central
// and potentially getting a wrong version.)
filter {
includeGroup "com.facebook.react"
}
forRepository {
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}**
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
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://www.jitpack.io' }
}
}
`
An error is as follows
`* What went wrong:
A problem occurred evaluating root project 'xwPad'.
Could not find method exclusiveContent() for arguments [build_el079orh1l6qkb8jbdvy6yi4f$_run_closure1$_closure2$_closure3@201b8227] on repository container of type org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.`
Does anyone know how to fix rn version 0.62
@cortinico I don't know whether to thank you for this fix, or to curse that you guys have cost me half of my weekend!
I'll go with a thank you instead :) but please, if you could be a bit more careful with things like this, and perhaps have test app builds with lower androidSDK versions to catch these before they get published that would be awesome.
Couldn't run the project after 4th Nov. When I am trying to run the project every time build is failing with these message.
@error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
- What went wrong:
A problem occurred configuring root project 'Peace Garden'.
Could not determine the dependencies of null.
Could not resolve all task dependencies for configuration ':classpath'.
> Could not resolve com.facebook.react:react-native:+.
Required by:
project :
> No matching variant of com.facebook.react:react-native:0.71.0-rc.0 was found. The consumer was configured to find a runtime
of a library compatible with Java 11, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.3.3' but:
my app.gradle file
**// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
kotlinVersion = "1.5.31"
if (System.properties['os.arch'] == "aarch64") {
// For M1 Users we need to use the NDK 24 which added support for aarch64
ndkVersion = "24.0.8215888"
} else {
// Otherwise we default to the side-by-side NDK version from AGP.
ndkVersion = "21.4.7075529"
}
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.1.1")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:5.0.1")
classpath("com.facebook.react:react-native:+")
classpath('com.google.gms:google-services:4.3.14')
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
exclusiveContent {
// We get React Native's Android binaries exclusively through npm,
// from a local Maven repo inside node_modules/react-native/.
// (The use of exclusiveContent prevents looking elsewhere like Maven Central
// and potentially getting a wrong version.)
filter {
includeGroup "com.facebook.react"
}
forRepository {
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
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' }
}
}**
anyone facing the same ?
exclusiveContent is not working, I'm using React-native version 0.66.3
For old react-native versions on gradle 6.1 and below you need a different workaround:
@yuvital-render please take a look at #35210 (comment)
@cortinico I am still getting an issue after I added the code block you instructed with, I followed the upgrade from 0.70.3 to 0.71.0rc
allprojects {
repositories {
exclusiveContent {
// We get React Native's Android binaries exclusively through npm,
// from a local Maven repo inside node_modules/react-native/.
// (The use of exclusiveContent prevents looking elsewhere like Maven Central
// and potentially getting a wrong version.)
filter {
includeGroup "com.facebook.react"
}
forRepository {
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
Hi, after applying the fix the build in eas works correctly, but when running the application in production in android it crashes at startup. Does it happen to anyone else? any solution?
+1.
in my case after digging around, it was looking for hermes.so file (which I don't use, disabled in the gradle file, and remove it after the build is done). And I still don't know how to fix it.
--------- beginning of crash 2022-11-06 11:39:26.214 8631-8696/*** E/AndroidRuntime: FATAL EXCEPTION: create_react_context Process: ***, PID: 8631 java.lang.UnsatisfiedLinkError: **couldn't find DSO to load: libhermes.so**
We had the exact same problem. Forced us to move to hermes, as all the known approaches to resolve the above error didn't work.
Do not post "me too" comments
This issue affects nearly everyone and github issues do not handle enormous numbers of comments well.
If you post metoo comments (or even "thank you"s) you are actively making it harder on your fellow developers to fix their builds by making it harder for them to find the relevant information.
If it works for you please share the solution with developers you know or retweet https://twitter.com/reactnative/status/1589296764678705155 - that will have a positive impact for other developers
It appears there may be a problem related to people not using hermes, though this has not been confirmed.
It is still our understanding that if applied correctly, we have these choices for a fix:
1- for the actual 0.71.0-rc.0 version you do not need a workaround
2- for "current" (react-native 0.64+ or 0.65, using gradle 6.2 or higher as determined in your gradle wrapper) - adding the exclusive repository definition described all the way at the top in the main description above works
3- for "old" (react-native 0.63 or lower, using gradle 6.1 or lower) - pinning the version via this workaround works #35210 (comment)
Thank you very much Sir @cortinico , my react native version is 0.66.4. your solution saved me ! it really works! Thanks again Sir.
Jesus, 24 active working hours troubleshooting this. THANK GOD I FOUND THIS POST. THIS IS SOLVED NOW!!!!!!
@cortinico I am still getting an issue after I added the code block you instructed with, I followed the upgrade from 0.70.3 to 0.71.0rc
allprojects { repositories { exclusiveContent { // We get React Native's Android binaries exclusively through npm, // from a local Maven repo inside node_modules/react-native/. // (The use of exclusiveContent prevents looking elsewhere like Maven Central // and potentially getting a wrong version.) filter { includeGroup "com.facebook.react" } forRepository { maven { url "$rootDir/../node_modules/react-native/android" } } } maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url("$rootDir/../node_modules/react-native/android") }
solution worked for me React native version i have added from application package.json wasn't correct no app version
got to node_modules -> react-native -> package.json // "version": "0.68.2", here worked version
android folder -> build.gradle file -> inside allprojects object add same version
configurations.all {
resolutionStrategy {
force 'com.facebook.react:react-native:0.68.2'
}
}
π’ patches
Please check top post for the list of patches.
We yesterday faced with this issue too
fixed easy:
in android/app/build.gradle
replace
implementation "com.facebook.react:react-native:+"
to
implementation ("com.facebook.react:react-native") version {
strictly "0.69.3"
}
NB: Use exact RN version from you project's package.json instead of "0.69.3"
This fix force Gradle to use exact version of RN instead of 0.70.x for the all modules in project
I faced this issue on Saturday. FYI, I used rn v0.67.4. When I tried to run android on my local machine, it was failed. the error message indicated on @react-native-async-storage/@async-storage
. I did clean my project gradle was no luck. However, on my Jenkins pipeline this issue did not occur. So, I concluded there is global caches somewhere in my machine. After googling it i found this rm -rf $HOME/.gradle/caches
. Solved the issue π
Hi, is there a workaround for this issue? I am on react-native version 0.67.2 and I tried upgrading to the patch version which is 0.67.5 but no luck in fixing the issue. I also tried upgrading react-native-reanimated to version 2.12.0 but that also didn't work.
> Configure project :react-native-reanimated
AAR for react-native-reanimated has been found
/home/dev/www/semco-mobile-v2/node_modules/react-native-reanimated/android/react-native-reanimated-67-hermes.aar
> Task :app:checkDevelopmentDebugAarMetadata FAILED
Execution failed for task ':app:checkDevelopmentDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (33) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-31).
Dependency: androidx.browser:browser:1.5.0-alpha01.
AAR metadata file: /home/dev/.gradle/caches/transforms-3/6ee2bdcdc6c5aa6fb9ff653c83fae0ba/transformed/browser-1.5.0-alpha01/META-INF/com/android/build/gradle/aar-metadata.properties.
@gabpaet that's unrelated, it appears you need to bump your minCompileSdk to 33 for unrelated reasons. Note this also transitively implies a bump of JDK to 11
enabled the new architecture after upgrading from 0.65.1 to 0.70.3 and I am trying to build the app and it always fails !!! Any idea what is the issue here ?
Task :app:buildCMakeDebug[arm64-v8a]
C/C++: ninja: Entering directory `/Users/adham/MobileX/android/app/.cxx/Debug/66286b3x/arm64-v8a'
C/C++: /Users/adham/MobileX/android/app/src/main/jni/MainApplicationModuleProvider.cpp:3:10: fatal error: 'rncli.h' file not found
C/C++: /Users/adham/MobileX/android/app/src/main/jni/MainComponentsRegistry.cpp:7:10: fatal error: 'rncli.h' file not found
Anyone has any idea regarding this issue ?
I have updated the patch version but no luck in fixing below issue.
> Task :expo-av:compileDebugLibraryResources FAILED
> Task :expo-file-system:compileDebugLibraryResources FAILED
> Task :app:mergeDebugResources FAILED
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
451 actionable tasks: 14 executed, 437 up-to-date
FAILURE: Build completed with 3 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':expo-av:compileDebugLibraryResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> 11 exceptions were raised by workers:
com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-4.0.1-6197926-osx Daemon #0: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-4.0.1-6197926-osx Daemon #3: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-4.0.1-6197926-osx Daemon #2: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-4.0.1-6197926-osx Daemon #4: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-4.0.1-6197926-osx Daemon #6: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-4.0.1-6197926-osx Daemon #8: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-4.0.1-6197926-osx Daemon #5: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-4.0.1-6197926-osx Daemon #7: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-4.0.1-6197926-osx Daemon #9: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-4.0.1-6197926-osx Daemon #10: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-4.0.1-6197926-osx Daemon #11: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':expo-file-system:compileDebugLibraryResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> 1 exception was raised by workers:
com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-4.0.1-6197926-osx Daemon #1: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
* 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.
==============================================================================
3: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Multiple task action failures occurred:
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-4.0.1-6197926-osx Daemon #12: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-4.0.1-6197926-osx Daemon #15: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-4.0.1-6197926-osx Daemon #13: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-4.0.1-6197926-osx Daemon #17: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-4.0.1-6197926-osx Daemon #14: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-4.0.1-6197926-osx Daemon #16: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-4.0.1-6197926-osx Daemon #18: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> AAPT2 aapt2-4.0.1-6197926-osx Daemon #19: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
* 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 10s
Info
System:
OS: macOS 13.0
CPU: (8) arm64 Apple M1
Memory: 52.09 MB / 8.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.18.1 - /opt/homebrew/opt/node@16/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 8.19.2 - /opt/homebrew/opt/node@16/bin/npm
Watchman: 2022.10.31.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9123335
Xcode: 14.1/14B47b - /usr/bin/xcodebuild
Languages:
Java: 11.0.17 - /usr/bin/javac
Python: Not Found
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.63.3 => 0.63.3
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Anyone has any idea regarding this issue ?
ζηgradle6.3δ»₯δΈηζ¬δΉζ―OKηοΌ
distributionUrl=https://services.gradle.org/distributions/gradle-5.4.1-all.zip
"react-native": "0.59.10",
this is good!
@SergeyMakogon-WD
I changed the version to '0.66.4' but android build failed:
You need v66.5 However I'm having an issue where v66.5 doesn't build for iOS, it does build Android however.
** BUILD FAILED ** The following build commands failed: SwiftEmitModule normal x86_64 Emitting\ module\ for\ react_native_file_access (in target 'react-native-file-access' from project 'Pods') (1 failure)
still fail...
for those who is using react-native-queue-it
, you might get the below error:
incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
Please follow cortinico's instruction for the hotfix, which works for me
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 23
compileSdkVersion = 31
targetSdkVersion = 31
}
repositories {
google()
// jcenter()
mavenCentral()
}
dependencies {
classpath('com.android.tools.build:gradle:4.2.2')
// classpath('com.android.tools.build:gradle:7.1.1')
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
// jcenter()
mavenCentral {
content {
excludeGroup("com.facebook.react")
}
}
maven { url 'https://www.jitpack.io' }
}
}
Above given is from build.gradle
Build file '/home/user/FCS/fleet-compliance-driver-app-android/node_modules/react-native-auth0/android/build.gradle' line: 95
- What went wrong:
A problem occurred configuring project ':react-native-auth0'.
Could not resolve all files for configuration ':react-native-auth0:implementation'.
Could not resolve com.facebook.react:react-native:+.
Required by:
project :react-native-auth0
> Cannot choose between the following variants of com.facebook.react:react-native:0.71.0-rc.0:
- debugVariantDefaultRuntimePublication
- releaseVariantDefaultRuntimePublication
All of them match the consumer attributes:
- Variant 'debugVariantDefaultRuntimePublication' capability com.facebook.react:react-native:0.71.0-rc.0:
- Unmatched attributes:
- Provides com.android.build.api.attributes.BuildTypeAttr 'debug' but the consumer didn't ask for it
- Provides org.gradle.category 'library' but the consumer didn't ask for it
- Provides org.gradle.dependency.bundling 'external' but the consumer didn't ask for it
- Provides org.gradle.libraryelements 'aar' but the consumer didn't ask for it
- Provides org.gradle.status 'release' but the consumer didn't ask for it
- Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
- Variant 'releaseVariantDefaultRuntimePublication' capability com.facebook.react:react-native:0.71.0-rc.0:
- Unmatched attributes:
- Provides com.android.build.api.attributes.BuildTypeAttr 'release' but the consumer didn't ask for it
- Provides org.gradle.category 'library' but the consumer didn't ask for it
- Provides org.gradle.dependency.bundling 'external' but the consumer didn't ask for it
- Provides org.gradle.libraryelements 'aar' but the consumer didn't ask for it
- Provides org.gradle.status 'release' but the consumer didn't ask for it
- Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
- 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 13s
at makeError (/home/user/FCS/fleet-compliance-driver-app-android/node_modules/execa/index.js:174:9)
at /home/user/FCS/fleet-compliance-driver-app-android/node_modules/execa/index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async runOnAllDevices (/home/user/FCS/fleet-compliance-driver-app-android/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/home/user/FCS/fleet-compliance-driver-app-android/node_modules/@react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Hallo guys any update for 0.64.2? how to fix this problem?
Hallo guys any update for 0.64.2? how to fix this problem?
Please follow this link
Hope it will work.
Yes it works, my react native version was 0.67.2, i had to upgrade this to 0.67.5 and reinstall the packages and its work now,
We need to change react-native version in package.json to the patches version mentioned above accordingly, i guess that works.
Added these lines in android/build.gradle and it worked fine for me.
https://github.com/facebook/react-native/issues/35210#issuecomment-1304536693
Works Smoothly thanks :)
Hallo guys any update for 0.64.2? how to fix this problem?
Hey @JasperIra12 and @Geryangro Can I know does it worked for you. Can you help me out. I am also using same RN version but I am getting same error.
@ivanhoe-dev
Hey. I saw your comment and I had similar error while building android this whole day.
As you mentioned to follow the instruction for the hotfix, I have downloaded the zip (version 0.66.5) which included bunch of files. I have no idea how to fix my project with the official zip. Could you share how to do it~? Thanks a lot.
> Task :bugsnag_react-native:compileDebugKotlin FAILED
.... Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.16.
My react-native version is 0.66.2 , same problem. I change package.json.
"react-native": "0.66.2", to "react-native": "0.66.5", solve this problem.
Hello All,
I am using react native version 0.63.0 and getting the below error :
.gradle/caches/transforms-2/files-2.1/fbb7a340b18cb1ab123bd8116e2b4a16/core-1.7.0/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.
Hello All,
I am using react native version 0.63.0 and getting the below error :
.gradle/caches/transforms-2/files-2.1/fbb7a340b18cb1ab123bd8116e2b4a16/core-1.7.0/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.
see Fix for older react-native (< 0.63) section
You need v66.5 However I'm having an issue where v66.5 doesn't build for iOS, it does build Android however.
** BUILD FAILED ** The following build commands failed: SwiftEmitModule normal x86_64 Emitting\ module\ for\ react_native_file_access (in target 'react-native-file-access' from project 'Pods') (1 failure)
still fail...
Just change the package name in package.json from 0.66.4 to 0.66.5 and reinstall the node_modules it worked for me.
i got this error :
CMake Error in CMakeLists.txt:
Imported target "folly_runtime" includes non-existent path
I added the ReactNative version configuration following this workaround and it workedοΌmy gradle version is 6.1
I added the ReactNative version configuration following this workaround and it workedοΌmy gradle version is 6.1
not work for me same error
Hello @mikehardy ,
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':react-native-webview:compileDebugKotlin'.
Compilation error. See log for more details
I am facing issue you please help me regarding on this
Hello All,
I am using react native version 0.63.0 and getting the below error :
.gradle/caches/transforms-2/files-2.1/fbb7a340b18cb1ab123bd8116e2b4a16/core-1.7.0/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.see Fix for older react-native (< 0.63) section
Getting this now:
Cause: react_dbl48axvbt6e0k1c9t3iq8qv8$_run_closure4$_closure6$_closure10$_closure18
Hi Brother! I got this error on startup. I don't know exactly what the problem is...
I fixed it!
with added this on (android/build.gradle) -
** exclusiveContent {
filter {
includeGroup "com.facebook.react"
}
forRepository {
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}**
this code under allProject{ repositories { ......here..}}
and updated gradle version on (android/gradle/wrapper/gradle-wrapper.properties)
distributionUrl=https://services.gradle.org/distributions/gradle-7.5.1-all.zip
Hello All,
React Native Version : 0.63.0
Firstly I got
.gradle/caches/transforms-2/files-2.1/fbb7a340b18cb1ab123bd8116e2b4a16/core-1.7.0/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.
I tried the below solution as recommended by @anhkieet
Add this in the allprojects area of your android/buld.gradle file.
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())
allprojects {
configurations.all {
resolutionStrategy {
// Remove this override in 0.65+, as a proper fix is included in react-native itself.
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
}
}
Then got the below issue :
Cause: react_dbl48axvbt6e0k1c9t3iq8qv8$_run_closure4$_closure6$_closure10$_closure18
Then deleted global .gradle file from system and restarted android studio through invalidate cache and restart and it worked finally.
Thank you @anhkieet
ANYONE WITH VERSION 0.63.0 CAN TRY THE ABOVE SOLUTION :-)
new error after this fix .
Apps targeting Android 12 and higher are required to specify an explicit value for android:exported
when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
my manifest file , i have added the android:exported="true" but no luck
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:usesCleartextTraffic="true"
android:allowBackup="false"
android:theme="@style/SplashTheme"
android:requestLegacyExternalStorage="true"
>
<!-- Change the value to true to enable pop-up for in foreground on receiving remote notifications (for prevent duplicating while showing local notifications set this to false) -->
<meta-data android:name="com.dieam.reactnativepushnotification.notification_foreground"
android:value="false"/>
<!-- Change the resource name to your App's accent color - or any other color you want -->
<meta-data android:name="com.dieam.reactnativepushnotification.notification_color"
android:resource="@color/white"/> <!-- or @android:color/{name} to use a standard color -->
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="conveyence" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value=""/>
<!-- You will also only need to add this uses-library tag -->
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
</application>
This solution worked for me Added this project build.gradle, in allProjects at the end
configurations.all {
resolutionStrategy {
force 'com.facebook.react:react-native:0.66.3'
}
}
Building on top of the original solution π,
In case anyone is looking for a solution within Gradle (without using command line & node. Might be helpful to avoid certain CI/CD restrictions)
def REACT_NATIVE_VERSION = {
def inputFile = new File("$rootDir/../package.json")
def packageJson = new JsonSlurper().parseText(inputFile.text)
return packageJson["dependencies"]["react-native"]
}()
allprojects {
configurations.all {
resolutionStrategy {
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
}
}
}
Building on top of the original solution π, In case anyone is looking for a solution within Gradle (without using command line & node)
def REACT_NATIVE_VERSION = { def inputFile = new File("$rootDir/../package.json") def packageJson = new JsonSlurper().parseText(inputFile.text) return packageJson["dependencies"]["react-native"] }() allprojects { configurations.all { resolutionStrategy { force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION } } }
You use in project node js?
I had to update from 0.63.4 to 0.63.5 (thanks for the patch!), but since then the app crashed on launch. ./gradlew clean
in the /android
folder fixed the crash and all is working again.
Affter update version 0.63.5, I have this error: "AAPT: error: resource android:attr/lStar not found".
Thanks for help.
@kildip
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':react-native-webview:compileDebugKotlin'.
Compilation error. See log for more details
I am facing issue you please help me regarding on this
I had same problem - try to bump this lib version
Actually none of those methods work in my case. My gradle doesn't support exclusiveContent
. And if i apply resolutionStrategy
, a new error appears:
* What went wrong:
Execution failed for task ':react-native-geo-fencing:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
My react-native & react-native-geo-fencing versions: "react-native": "0.61.5", "react-native-geo-fencing": "^0.1.0"
Is there a reason why 0.68.5 has contents.xcworkspacedata removed from iOS? The Xcode doesn't open the project correctly after removing this file.
https://react-native-community.github.io/upgrade-helper/?from=0.68.4&to=0.68.5
Thank you for making me waste 2 fucking days
Is there a reason why 0.68.5 has contents.xcworkspacedata removed from iOS? The Xcode doesn't open the project correctly after removing this file.
react-native-community.github.io/upgrade-helper/?from=0.68.4&to=0.68.5
@Aleksefo thanks for pointing it out, it's not intended. It's probably a side effect of the pipeline generating the diff - the only change you should have to handle is the bump of the version. I'll look into manually patching the rn-diff-purge repo that feeds the data to upgrade-helper to remove that unwanted change.
Excuse me, but how can i install this patch https://github.com/facebook/react-native/releases/tag/v0.64.4 ?
Excuse me, but how can i install this patch https://github.com/facebook/react-native/releases/tag/v0.64.4 ?
In your package.json change react-native version to 0.64.4 and run yarn install
@Libero793 the issue is pinned in this repository (at the top of the issues list), has been tweeted by a few people and is searchable. Please publicize it any other way you can if you feel it is missing publicity @kaishuvam7 unfortunately, I think you may have some unrelated issue. Your stackoverflow does not in general meet stackoverflow guidelines: https://stackoverflow.com/help/how-to-ask / https://stackoverflow.com/help/minimal-reproducible-example so does not have the information required to help
@mikehardy It would be great if info about this issue could be given through the metro terminal because it will save developers time.
It took me about a day's debugging and researching about this error to finally reach here from some other issue at some other package.
Same problem here, need step-by-step solution for rn 63.4
@cisplRejjak I've updated the top comment with clear instructions. Change the package.json version, yarn install.
Thanks solve π― work π
After installing 0.64.4 patch react-native run-android
fails with Cannot run Project.afterEvaluate(Closure) when the project is already evaluated.
error.
Output of react-native info
System:
OS: macOS 12.6
CPU: (10) arm64 Apple M1 Max
Memory: 6.30 GB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.17.1 - ~/.nvm/versions/node/v16.17.1/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 8.15.0 - ~/.nvm/versions/node/v16.17.1/bin/npm
Watchman: 2022.10.24.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0
Android SDK: Not Found
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9123335
Xcode: 14.0/14A309 - /usr/bin/xcodebuild
Languages:
Java: 11.0.16.1 - /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
doesn't work for 0.64.0 still 4 errors, but for now with external dependencies(libraries that we use). We didn't have this on the 3rd of November, any solutions?
Upgrading from version 0.66.3
to 0.66.5
fixed this: v0.66.3...v0.66.5
Is there anything 3rd party library authors need to do, to prevent this from ever happening again?
Thanks solve π― work π
Hello please can you tell me the steps after downloading the particular patch version... i use a mac
Thanks solve π― work π
Hello please can you tell me the steps after downloading the particular patch version... i use a mac
You should run a yarn && cd ios && pod install
π
Then build the Android app again, if this doesn't work try doing a cd android && ./gradlew clean
Thanks solve π― work π
Hello please can you tell me the steps after downloading the particular patch version... i use a mac
You should run a
yarn && cd ios && pod install
π
like.. I downloaded this this
what next ?
Thanks solve π― work π
Hello please can you tell me the steps after downloading the particular patch version... i use a mac
You should run a
yarn && cd ios && pod install
πlike.. I downloaded this this
what next ?
what I am actually asking is, "how to install the patch? "
Pls help anyone
stuck at this issue #35210 (comment)
what I am actually asking is, "how to install the patch? "
Ahhh, you can run a yarn add react-native@0.XX.X
followed by the other commands
Hm, faced an issue when I tried to update from 0.64.3 to 0.64.4.
run after install yarn package - cd android && ./gradlew clean && cd ..
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Script '/Users/ashalbulk/projects/project/node_modules/react-native/react.gradle' line: 360
* What went wrong:
A problem occurred evaluating script.
> Cannot run Project.afterEvaluate(Closure) when the project is already evaluated.
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':app'.
> compileSdkVersion is not specified. Please add it to build.gradle
* 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
npx react-native info
info Fetching system and libraries information...
System:
OS: macOS 13.0
CPU: (8) arm64 Apple M1
Memory: 82.13 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.18.0 - /opt/homebrew/opt/nvm/versions/node/v16.18.0/bin/node
Yarn: 1.22.19 - /opt/homebrew/opt/nvm/versions/node/v16.18.0/bin/yarn
npm: 8.19.2 - /opt/homebrew/opt/nvm/versions/node/v16.18.0/bin/npm
Watchman: 2022.09.12.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/lib/ruby/gems/3.0.0/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9123335
Xcode: 14.1/14B47b - /usr/bin/xcodebuild
Languages:
Java: 15.0.4 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: 0.64.4 => 0.64.4
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
The main problem occurs during bundling in android OS
After running npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle, process exited with thrown error Failed to construct transformer: Error: Cannot create a string longer than 0x1fffffe8 characters - screenshot -
Have included kotlinVersion = "1.6.0" in android/build.gradle but still not working
Please help !!!
Android app build fails with this error after upgrading to 0.68.5
* What went wrong:
Execution failed for task ':expo-modules-core:buildCMakeDebug'.
> Build command failed.
Error while executing process /Users/dinaashraf/Library/Android/sdk/cmake/3.10.2.4988404/bin/ninja with arguments {-C /Users/dinaashraf/Projects/PetMediaGroup/packages/mobile/node_modules/expo-modules-core/android/.cxx/Debug/1t3b401t/armeabi-v7a expo-modules-core}
ninja: Entering directory `/Users/dinaashraf/Projects/PetMediaGroup/packages/mobile/node_modules/expo-modules-core/android/.cxx/Debug/1t3b401t/armeabi-v7a'
ninja: error: '../../../../build/react-native-0.68.4.aar/jni/armeabi-v7a/libfbjni.so', needed by '../../../../build/intermediates/cxx/Debug/1t3b401t/obj/armeabi-v7a/libexpo-modules-core.so', missing and no known rule to make it
update:
Build succeeded after I upgraded gradle to 7.1.1 inside android/build.gradle
dependencies {
classpath('com.android.tools.build:gradle:7.1.1')
Worked for 0.66.4 -> 0.66.5
@JodiRaina that likely indicates your gradle plugin or gradle is too old to use this advice - it appears gradle 6.1 and older does not have the exclusiveContent / include filter in the preferred solution.
If you cannot upgrade gradle (and react-native...), you might try one of the fallback workarounds for old react-native using very old gradle plugin / gradle, specifically this one, which was the best-known solution if exclusiveContent is not available / until the exclusiveContent idea occurred
@brentvatne @ Expo proposes this as a refinement to avoid the hard coded version, it is the same as the previous best-known solution but now with dynamic version powers, otherwise same idea - you put this in the allprojects area of your
android/buld.gradle
filedef REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim()) allprojects { configurations.all { resolutionStrategy { // Remove this override in 0.66, as a proper fix is included in react-native itself. force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION } }Note that the exclusiveContent idea is a cleaner solution, but of course only if your gradle supports it
My APK build crashed. But it works fine in simulator.
"react-native": "0.60.3",
distributionUrl=https://services.gradle.org/distributions/gradle-6.7.1-bin.zip
I just want to point out some people might be getting this error instead of the one you guys have reported in the instructions.
Manifest merger failed : uses-sdk:minSdkVersion 19 cannot be smaller than version 21 declared in library [com.facebook.react:react-native:0.71.0-rc.0]
This too will be fixed by upgrading to your respective react-native patch.