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.
Related
I'm just starting out in Reactjs.
I have a RedHat Linux VM.
I've installed nodejs and created a simple reactjs application:
npx create-react-app my-first-project
My first project works OK.
Now I have found this great reactjs package with a demo:
https://github.com/TarikHuber/material-ui-filter
I want to install the demo part of this package that consists of index.css, index.html, app.js, index.js
How would I go with this?
Where do I put this new code relative to my-first-project?
How do I call this new code?
The package I think calls redux so I assume I will install this first.
Thanks.
You should learn how npm works. If you find some cool package and you want to use it then you have to install that package. There is a installation command on Readme file on that github repo. Install package via npm install material-ui-filter then you can just use the html file on demo project.
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'm having trouble installing React on an empty project in WebStorm. The instructions on the WebStorm help page tells me to get create-react-app.
Is there a way I can just get react? And if not, what is the difference between the two?
I'm trying to follow this specific tutorial series online about React for beginners. It's a 4 minute video so can anyone please explain to me what the youtuber did?
I would recommend using create-react-app because you will not need to install or configure tools like Webpack or Babel.
You need to install it from https://github.com/facebook/create-react-app if you have npm (node package manager) installed you can just type npm install -g create-react-app
I am coding with React Native. I don't see that when I first create react-native app for check running. When I implements my code see that. My purpose is generate apk.
app.json
build.gradle
index.js (index.android.json)
App package.json
Solved
Result: I solved my problem with npm install. I would like say many month after.
If anyone's getting this error after upgrading Expo, try restarting your simulator - that fixed it for me.
Here is my experience if someone using expo sees those error message.
I accidentally installed expo manually in my project which was version 29.0.0.
I was using version 28.0.0 of expo sdk, so it may have crashed inside.
What I did:
manually upgrade sdkVersion of app.json to 29.0.0.
change sdk version to 29.0.0 for react-native.
Had exactly the same error - fresh machine, fresh npm, only one version of expo installed.
Turns out, expo requires you to build it as an app before it can send it to the expo app properly (at least on Android). This is easiest done by:
Adding an "android" section to app.json, with the contents "package": "uk.co.yourcompany.yourpackagename" (this is required by android packages. It can be complete garbage, but should follow that format - a backwards domain name)
running expo build:android and following the instructions to sign up to expo's servers and build the app
then restarting expo start
Not sure if this is documented anywhere though, so may be a new thing?
Another thing to try is to move your node_modules folder away (or maybe delete it, up to you) and re-run npm install
According to the official tutorial: https://facebook.github.io/react-native/blog/2017/03/13/introducing-create-react-native-app.html
If you want to use expo in your application, you must create it in the following way
npm i -g create-react-native-app
create-react-native-app my-project
cd my-project
npm start
This will start the React Native packager and print a QR code. Open it in the Expo app to load your JavaScript.
as I see your code has files that are not necessary, such as build.gradle and index.js, the structure that create-react-native-app creates is different and easier to use
I was getting the same error after updating the expo-cli to version 3.0.6.
By looking at my package.json I noticed the expo-cli version installed on my computer is not the same as package.json. so I changed it to "expo-cli": "^3.0.6" and ran npm install || yarn, then the error disappeared!
I have been following many react tutorials(just getting started). In all of them, node modules are locally installed within each project. But I don't want to download node modules all the time for each project. I want to install node modules(only react related packages like babel, webpack, webpack-dev-server, react and react-dom) globally, which resides in following location in windows (C:\Users\username\AppData\Roaming\npm\node_modules) and then refer them for all of my react projects and also bundle them using webpack. How can I do that? I tried searching, but did not get any solution so far. Kindly let me know if there are any options to achieve that.
Thanks.
Using global package is not a good idea. It is only recommended for development
You can use npm link <global-package> to use your global modules like local.
Link to refer https://docs.npmjs.com/cli/link
You can use npm install -g 'package name' to install it globally.