I am working on react native push notification and configuring fcm in my build.gradle file
I am getting error
> Task :react-native-device-info:compileReleaseJavaWithJavac
Note: E:\IOOLABS\Projects\mobeApp\mobeApp\node_modules\react-native-device-info\android\src\main\java\com\learnium\RNDeviceInfo\RNDeviceModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :react-native-fcm:compileReleaseJavaWithJavac
Note: E:\IOOLABS\Projects\mobeApp\mobeApp\node_modules\react-native-fcm\android\src\main\java\com\evollu\react\fcm\SendNotificationTask.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :react-native-i18n:compileReleaseJavaWithJavac
Note: E:\IOOLABS\Projects\mobeApp\mobeApp\node_modules\react-native-i18n\android\src\main\java\com\AlexanderZaytsev\RNI18n\RNI18nModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :react-native-video:compileReleaseJavaWithJavac
Note: E:\IOOLABS\Projects\mobeApp\mobeApp\node_modules\react-native-video\android\src\main\java\com\brentvatne\react\ReactVideoViewManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
here it is app/build.gradle configuration
dependencies {
compile project(':react-native-fcm')
compile 'com.google.firebase:firebase-core:10.0.1' //this decides your firebase SDK version
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile project(':react-native-config')
compile project(':react-native-sound')
compile project(':react-native-vector-icons')
compile project(':react-native-video')
compile project(':react-native-file-chooser')
compile project(':react-native-audio')
compile project(':react-native-image-picker')
compile project(':react-native-i18n')
compile project(':react-native-device-info')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.facebook.react:react-native:+'
}
and android build.gradle file is
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
// PLEASE DO NOT CHANGE GRADLE VERSION
classpath 'com.google.gms:google-services:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
help me how to resolve it
This is the conflict of android jar library.
It is common error.
You need exclude module or something?
I can't answer your question, because It is few information about your error.
What I want to say is react-native-device-info and react-native-fcm very often conflict!. (the two library use same jar file.)
try search exclude module or force in build.gradle.
And, react-native-firebase is better fcm library than react-native-fcm.
Try it.
Read it!
How to solve Google Play Services version collision in gradle dependencies
https://medium.com/#suchydan/how-to-solve-google-play-services-version-collision-in-gradle-dependencies-ef086ae5c75f
Welcome to React Native!!!
did you try jetify ?
First, use Android Studio's refactoring tool to convert your app re: the Android developer docs
npm install --save-dev jetifier
npx jetify
npx react-native run-android (your app should correctly compile and work)
Call npx jetify run in the postinstall target of your package.json (Any time your dependencies update you have to jetify again)
For more informations :
jetify
Related
I've a problem with babel-plugin-macros, currently I created a component package with twin.macro, the compiler shows a success message, and the npm publish command too. But, if I install the library and use on my project shows the next error:
MacroError: The macro you imported from "undefined" is being executed
outside the context of compilation with babel-plugin-macros. This
indicates that you don't have the babel plugin "babel-plugin-macros"
configured correctly. Please see the documentation for how to
configure babel-plugin-macros properly:
https://github.com/kentcdodds/babel-plugin-macros/blob/master/other/docs/user.md
The libraries babel-macros-plugin and tailwind already been setup in the project
I go this same error because we changed some files to .tsx and forgot to update the babel extensions.
Error message screenshots
1. Photo
2.Photo
3.Photo
Version of nodejs
Based on the screenshots, you are attempting to install the node-sass package.
It's deprecated and, as you can see, depends on a binary module that needs to be compiled separately on Windows using the Visual Studio toolchain.
You have two options:
follow the instructions in the readme to also install the node-gyp prerequisites
switch your project to use the sass module (recommended).
I ran an analyzer on my production build, and there is weird xlsx(cpexcel.js) and moment.js library that I've not used anywhere in my App's code, also I am using react-rainbow library, though I have only imported only a few of components from there(Navbar), in the build, Whole library is included.
see source-map-explorer picture:
How can I make production build exclude these unused libraries and unused components?
Go to the project's root folder and run
npx depcheck
It will display all the unused packages in your project.
To uninstall a module simply run the below command
npm uninstall <package>
I'm using React Native 0.61, and have been reading about the new auto-linking feature. If you have any insight on ANY of the following questions, I'd appreciate it.
My Questions Are:
1) My understanding of react-native link <module> is that it adds a line for <module> to your Podfile, and then you run pod install. However, for the last year I've been using react-native link and linking manually, and have never run pod install. So am I right that react-native link does more than just add lines to your Podfile?
2) In the past, when react-native link failed to link the module, I manually linked it by dragging the .xcodeproj and .a files into Xcode as described here. Does react-native link (when it works) add the line to your Podfile AND add .xcodeproj and .a files into Xcode for you?
3) Is there anything involved in native modules being linked other than the .xcodeproj and .a files being added to Xcode?
4) What exactly does pod install do? Does it take all the native modules referenced in your Podfile and add .xcodeproj and .a files into Xcode? If so, that would involve two steps: adding the line to your Podfile and then running pod install. Why not just react-native link?
5) My understanding of auto-linking is that it adds lines for all native modules to your Podfile, and then you still have to run pod install. Isn't this just accomplishing the same thing as react-native link?
6) In this guide to auto-linking, it says "Autolinking is a replacement for react-native link. If you have been using React Native before version 0.60, please unlink native dependencies if you have any from a previous install.". Why does it tell you to unlink? If the module is already linked, what will unlinking it and re-linking it do? This implies there's a difference between the way modules are linked with react-native link and via auto-linking. What happens if you auto-link and then pod install, and then try using react-native link, or vice versa?
7) I outlined this in the previous questions, but just to make it concise, what is the difference between auto-linking + pod install and react-native link?
All of your questions are closely intertwined so I'm going to just give you the details that will hopefully clear up things for you.
If React Native version <= 0.59 AND Cocoapods is NOT used in
the project :
react-native link will just add the .xcodeproj file and the .a file to the XCode Project. It will NOT add any lines to the Podfile because in this case, the Podfile doesn't exist.
If React Native version <= 0.59 AND Cocoapods is used in the
project :
react-native link will add the lines to the Podfile and install pods. It will NOT add .xcodeproj or .a file to the XCode Project. This is assuming that the library supports Cocoapods installation. How do you know if the library supports Podfile installation ? They mention it on their Github page/NPM page. Also, such libraries will have a .podspec file as well.
Example : https://github.com/react-native-community/react-native-device-info
See that this library has a .podspec file -> RNDeviceInfo.podspec. So this supports Cocoapods installation.
If the library doesn't support Cocoapods installation, react-native link will just add xcode.proj and .a file to the XCode Project like the above case.
If React Native version >= 0.61 (Cocoapods is default in this case)
react-native link is NOT required anymore.
You just install the library (yarn add or npm install)
And then do pod install.
What happens here is, Cocoapods grabs the library from the node_modules folder, checks if there is a .podspec file and then installs the pods. But it DOESN'T add any lines to the podfile. This is auto-linking that's been introduced in React Native version 0.60.
In case of older libraries that DO NOT have a .podspec file, you need to manually link the library by react-native link.
My project is going from standalone to Web, Our new WebSite is getting created in AngularJS so Protractor is the tool selected for Test Automation.
I want to Integrate Typescript with dependencies of Jasmine and Node so that I don't get errors such as
cannot find name Describe
cannot find name it
cannot find name Expect
Can Anyone tell me how to add Jasmine and Protractor dependencies, so that when I hit ctrl + space i'll get all options available.
I have installed Typescript. And I am getting protractor dependencies such as browser, element, by etc.
What should i do for describe,it,expect (Jasmine stuffs) ?
I use Visual Studio Code everyday to write my scripts, it's my current favourite editor for Protractor because of its built in support for TypeScript!
Here are the following things which can come into my mind which could help you setup your framework-
Download the latest VS Code version - https://code.visualstudio.com/download
Install typescript globally npm install -g typescript
Install protractor globally npm install -g protractor
Create your project folder
Setup you project folder for git, node and typescript -
npm init -f // will create default package.json stating its nodejs project
git init // will create .git file, you project is now git project
tsc --init // will create tsconfig.json stating its typescript project
Install typings and dev dependencies-
npm install --save-dev protractor // this will install protractor as a dev dependency
npm install --save-dev typescript // this will install typescript as a dev dependency
npm install --save-dev #types/jasmine // jasmine typings
npm install --save-dev #types/node // node typings
At this point you have setup your basic protractor-typescript project and you can see all the typings and dependencies in package.json. Now you are good to write your typed scripts :).
Now compile your scripts by running -
tsc or tsc -w
After successfull compilation all your javascript files would be generated.
The run protractor
protractor config.js
You can also setup your vs code for debugging with protractor which I have mentioned here - Protractor -VS Code Debugging
For more details pls refer the TypeScript Tutorial, Protractor API
The Typescript error you are observing this is due to VS Code not recognizing global typescript 2.0 version.
To solve this open vscode go to preferences--> user settings --> settings.json will be opened and enter the highlighted path as shown
Save your file and restart VSCode now you are good to go :)
I agree with the answers given. Just want to share a hack with you.
You don't need to transpile your Typescript codes to JavaScript anymore.
Create a launch.js file
require('ts-node').register({
compilerOptions: {
module: 'commonjs'
},
disableWarnings: true,
fast: true
});
exports.config = require('./config/protractor.conf.ts').config;
And kick start protractor execution like:
> protractor launch
You can save yourself from the headache of transpiling every time you make a change to typescript files.
Happy testng!