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'
update this below content in project level build.gradle:
allprojects {
repositories {
exclusiveContent {
filter {
includeGroup "com.facebook.react"
}
forRepository {
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
// ...
}
}
it's working for me
FIX INSIDE
Steps to resolve the react-native issue that we are facing since couple of days.
Goto package.json and upgrade the react-native version to 0.64.4.(or whatever the supported version we have on the GitHub thread)
Run yarn install.
Now cd android
./gradlew clean
cd ..
yarn android (now your project will execute properly)
Note: This issue occurred because of the new release of the react native(4th nov), here I'm attaching the link for the reference.
URL : https://github.com/facebook/react-native/issues/35210
(if you face any issues do let me know i'll help you in resolving the same.)
This fix works:
Reason for Failures : The build failures for Android was due to the publish of the React Native version 0.71.0-rc0 to Maven and because of which when the gradle is syncing its picking this 0.71.0-rc0 version of react-native rather then your current version of react-native.
Made it work without upgrading react-native version and by adding this in build.gradle, this works (hermes enabled or not, along with flipper too)
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"
}
}
}
final snippet looks like this
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")
gradle clean and rebuild after this fix. Then you can react native run android successfully.
What this fix will do is apply an exclusiveContent resolution rule that will force the resolution of React Native Android library, to use the one inside node_modules
If you dont want to put this fix, you can update your react native version for the project to the react native patch version as mentioned here
https://github.com/facebook/react-native/issues/35210
Related
I get /bin/sh: 1: tsc: not found error on build in Gatsby Cloud.
How can I fix this to build successfully?
I believe the reason for this would be I am specifying a branch for a npm package.
The npm package doesn't provide features I need and I cannot wait for PR to be merged, so I forked and modified the package with specifying it in package.json like:
{
"dependencies": {
"some-package": "https://github.com/xxxx/some-package.git#temporary"
}
}
It works fine on local development but not when building in Gatsby cloud.
Is there any way to fix this?
I tried to use gatsby-plugin-typescript(link) but didn't work.
In my portfolio app, I'm trying to merge a PR into the main branch, which contains code to implement React Query. The app works fine on development but when I try to deploy it, Vercel gives me the error above that apparently occurs when they try to build my app.
I tried installing ts-toolbelt as a dependency but it doesn't seem to work.
Here's the project's repo and precisely to the failing PR (You wont' get access to the vercel deployment details as it's my account, but every error that appears is shown in the picture above)
Same thing happened to me and after some research looks like the ts-toolbar version that comes in the React-Query package is not compatible with the Typescript version my React app is using.
To fix it I added a resolutions field on the package.json to force the ts-toolbelt dependency to a compatible version, like so:
"resolutions": {
"ts-toolbelt": "6.15.5"
}
6.15.5 being the ts-toolbelt version compatible with my Typescript version (3.8.3)
Then running yarn install solved the issue for me.
I have found a framework for integrating IronSource ad network with my react native project here.
I have a searched a lot in internet and have already tried opening an issue in the repository but no luck.
I did as it said in the readme file like so:
First installing the dependency
npm install #wowmaking/react-native-iron-source --save
Then linking the dependency
react-native link #wowmaking/react-native-iron-source
And finally importing the dependency
import { IronSource } from '#wowmaking/react-native-iron-source';
But as soon as I try to run my application I get this error:
native module cant be null
I don't know if I'm doing it right or not please help!
I'm using react native 0.60.5
I'm contributor of #wowmaking/react-native-iron-source.
Readme was updated for RN 60 last month. You dont need to link it anymore for RN 60.
npm install #wowmaking/react-native-iron-source --save
Add a repo to your android/app/build.gradle file
allprojects {
repositories {
// Existing repos here
// ...
maven { url "https://dl.bintray.com/ironsource-mobile/android-sdk" }
}
}
You are ready to run your app.
Add mediation networks which you need. Follow official docs.
https://github.com/wowmaking/react-native-iron-source#mediation-setup
Re-build your project via:
react-native run-android
I am in the middle of trying to upgrade an app from React-Native 0.55 to 0.60.2 to enable 64 bit support before the Google deadline. When I try to manually upgrade the App, (react-native upgrade only brings it to 0.58) running the expo build gives a response:
error: unknown option `--nonPersistent'
The app builds fine with the older versions, and a grep search of the directory gives no results for the phrase 'nonPersistent.' How do I fix this problem?
react-native upgrade
react-native-git-upgrade
Manually changing package.json
error: unknown option `--nonPersistent'
If you are using Expo, you might need to remove nonPersistent option from packagerOpts inside app.json file.
{
"expo": {
...
"packagerOpts": {
"nonPersistent": "--nonPersistent", <- remove this
...
}
...
}
This error happened after I upgraded from Expo SDK 35 to 36.
I forgot what this option was for...
After removing this I can use expo start as usual.
For reasons beyond my comprehension, changing the version of react-native in package.json from 0.60.2 to 0.59.9 fixed the issue.
I'm implementing In-app-billing on my React Native project using this.
https://github.com/idehub/react-native-billing
This is the code I'm using.
InAppBilling.open()
.then(() => InAppBilling.purchase('android.test.purchased'))
.then((details) => {
console.log("You purchased: ", details)
return InAppBilling.close()
});
and I got this error.
Can anyone help me with the solution? Thanks in advance.
This from the GitHub issue:
"Easiest way is to run react-native link react-native-billing
after npm install --save react-native-billing. That will add the
native build config for you. The link command will be adding the
native config, and you do not have to follow the manual installation.
But your build.gradle should not contain com.anjlab.android.iab.v3
since that is added by this module in another file. Yours should
instead have something like compile project(':react-native-billing')."
After making a change like this I always run these in the terminal to reset everything and then refresh the app afterwards:
watchman watch-del-all
node_modules/react-native/packager/packager.sh --reset-cache
The only time I've succeeded with this is by re-ejecting the app, rebuilding node modules and pods, and linking all libraries at the very end with react-native link.
Did you try to uninstall and install app after install the library?
If you just reload the app with the node files will not work. You need to unsinstall and reinstall the app to get the Inappbilling in your application.