React-Native - Could not find com.google.android.gms:play-services-analytics:15.0.1 - react-native

When trying to install Pushnotifications for Android in a React Native project I get the following error during building
Could not find com.google.android.gms:play-services-analytics:15.0.1.
I cannot find the place where I would require play-services-analytics. Anyone a clue how I could solve this issue?

I had the same issue. Sometimes, the dependency version used by a package is no longer the recommended minimum that's been pushed by Google. To fix, locate the build.gradle file for the package that is giving you the error (in this case, it should be react-native-push-notification) and change locate the line that contains play-services-analytics under the dependencies, then change the version number to the recommended minimum version listed here. For play-services-analytics, it should be 16.0.5. Here's how it should look like afterward
implementation "com.google.android.gms:play-services-analytics:${safeExtGet('googlePlayServicesVersion', '16.0.5')}"
By far, the easiest way I've found to debug these package error is to get Android Studio. When you run the App from there, it'll error out on any dependency error and open up the gradle file for you, then you just have to fix it.

Related

How to Upgrade React Native Version 0.66.3 to 0.70.6?

Currently, my project running on the 0.66.3 version I need to upgrade to react native version 0.70.6. So I have used to following command
npx react-native upgrade
After running this command showing some error I have attached a screenshot please refer.
I am also trying the manual way using react native helper but some files are not available in my project.
so anyone please tell me how I will upgrade my project version?
After Run npx react-native run-android my build was created successfully but 3 errors showing in the metro bundler. I have attached a screenshot of the metro bundler error.
you can specify a React Native version and pass it as an argument:
npx react-native upgrade 0.70.6
you can also refer this official documentation for this
& it will also helps you if you got any error.
https://reactnative.dev/docs/upgrading
I found by changing react-native - index.js and react-native/Libraries/Text - index.js
Follow this link for output:
https://github.com/facebook/react-native/commit/3f629049ba9773793978cf9093c7a71af15e3e8d
Don't know whether it is the right way or not....
Since upgrading an application can break functionality in your app if you do not know what is needed to be changed. the upgrade is tells you to visit the pages to go through and see what has changed throughout the upgrading process.
Other as that I am just needing more information regarding to what is not working. Since upgrading is more as just running a command, its about reading the documentation and see what part is missing and what they replaced the files with. The missing files could be straight-out deprecated and not working with the new version.
As always check the debugger and read every message throughout and visit all links given and see the documentation regarding the upgrade differences, find out if there are any log files you could look at, and talk with people in your company / group of react-native about this.
"Some files are not available in my project"
This part might just be able to google and see if this is still supported or not in the version it could be phased out, or not supported in the version. that's where versioning comes in to play.
I am unsure what files and which libraries are deprecated based on your Opening Post, this needs more information, to help us, help you.

Expo modules core dependency.platformns.ios must be of type object

I just updated to Expo 43.0 in a bare workflow project and followed the guide on how to update the app to also use expo-modules-core. The app runs in dev mode and can compile to both Android and iOS. However, when running react-native-start the following message is shown in the terminal:
warn Package expo-modules-core has been ignored because it contains invalid configuration. Reason: "dependency.platforms.ios" must be of type object
Then the metro server starts. I have tried searching for others with similar issues, does anyone know what may be causing this?
I followed this guide: https://docs.expo.dev/bare/installing-expo-modules/
This warning is coming from react-native-community autolinking. it looks like the api changed and they don't accept null values anymore, but this is what they still specify in their docs. the behavior you see is expected still - expo-modules-core is and should be ignored by react-native-community autolinking, because it's handled by expo autolinking. so, this won't impact your project and it's a warning caused either by an accidental regression or undocumented change in react-native-community autolinking.
https://github.com/expo/expo/issues/16085
Yes, it is coming from react-native. So for resolving this issue you have to remove the react-native.config.js file from node_modules
Follow the bellow steps:-
Go to node_modules/expo-modules-core
Delete react-native.config.js

React Native background location (#mauron85/react-native-background-geolocation) - problem installing, how to link modules with Expo managed workflow?

I'm developing a sports app with React Native / Expo which needs to track user background when the app is in the background.
This is related to my previous question (React Native expo-location: How to make the background location service update more often?). I came to the conclusion that the background location tracking in the 'expo-location' package does not seem to sufficiently work, so I started building a new solution based on the package '#mauron85/react-native-background-geolocation' (https://github.com/mauron85/react-native-background-geolocation) which I found was recommended in several tutorials.
So I installed the module and built my map component based on the example code provided in the documentation (https://github.com/mauron85/react-native-background-geolocation#quick-example).
However, when running the app on Expo Go, I get the following error message despite doing all the required imports:
Component Exception: RNBackgroundGeolocation is undefined
This appears to be caused by a problem in linking modules, which I failed to do during the installation. The component requires to do linking of modules with the following command:
node ./node_modules/#mauron85/react-native-background-geolocation/scripts/postlink.js
Because I use Expo managed workflow, I lack the folder structure (./android/settings.gradle etc) required by this script and receive an error of 'android/settings.gradle not found'. Based on some searching, this seems to require running 'expo eject' on the whole project so that I can do configurations in the platform-specific folders.
However, 'expo eject' runs into errors in the "Installing JavaScript dependencies" phase and just returns an error of "Something went wrong ... ...", and the error logs provide no further clarification.
Questions:
How to get forward when something goes wrong in the 'expo eject' phase like this? The error logs get really messy and unclear.
I would really prefer to stay in the managed workflow to avoid any mess. Is there a way to get the modules linking work within the Expo managed workflow?
Any help appreciated, thanks.

Unable to resolve module `#babel/runtime/helpers/interopRequireDefault` in recent versions of React Native

I am trying to upgrade an old React Native app version (v.55) to the latest (v.61). I started this process by running react-native init [project name]. I then copied only my JavaScript files into the new project. I then try to build, it tells me I am missing a module, I install the module, repeat.
However there is one issue that I can not seem to solve:
error: bundling failed: Error: Unable to resolve module `#babel/runtime/helpers/interopRequireDefault` from `../javascript_shared/HomeScreen.js`: #babel/runtime/helpers/interopRequireDefault could not be found within the project.
I am running
react: 16.9.0
react-native: 0.61.5
#babel/core: 7.7.4
#babel/runtime: 7.7.4
I have searched and searched, all coming up with the same answer: Downgrade #babel/runtime to version 7.0.0-beta.55 due to some change being made after that version. This, however, changes nothing (not to mention I would prefer not to revert to such an old version). I have cleared every cache and whatnot but still the same issue remains.
If I look in node_modules/#babel/runtime/helpers I do see a interopRequireDefault.js.
There seem to be no forum posts of people having this issue with these recent versions anywhere.
I (sort of) figured it out.
I had a folder with JavaScript in it one level up (../javascript_shared/) and something in the build process did not like that. I had watchFolders in metro.config.js but apparently that was not enough.
I just moved this folder into the project root (where my package.json and index.js are).
Although this is not a proper solution I hope this helps someone. Maybe it will give that person the next place to look.

Has anyone managed to make react-native-device-info with react-native 0.58?

I am trying to get the deviceid with react-native-device-info.
I started with an empty expo project which I ejected.
I imported the library, I also linked it.
But then I get gradle errors in android studio.
Have anyone managed to make it working. Can you tell which version you use?
Error from comments:
:ERROR: In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[15.0. 1]", but isn't being resolved to that version.
Behavior exhibited by the library will be unknown.
Dependency failing: com.google.android.gms:play-services-flags:15.0.1 -> com.google.android.gms:play-services-basement#[ 15.0.1], but play-services-basement version was 16.2.0