How to install dependencies from package.json? - android

So, I have a NaticeScript project which requires a bunch of modules. I'm familiar with Node.Js but new to NativeScript. Here's my package.json. I'm not able to run the project because it doesn't have all the modules.
"dependencies": {
"#proplugins/nativescript-dom": "^2.2.1",
"#proplugins/nativescript-master-technology": "^1.2.0",
"#proplugins/nativescript-permissions": "^1.5.0",
"#proplugins/nativescript-platform-css": "^1.8.0",
"#proplugins/nativescript-purchase": "^4.0.1",
"#proplugins/nativescript-zxing": "^1.7.0",
"bad-words": "^3.0.3",
"guid-typescript": "^1.0.9",
"is-integer": "^1.0.7",
"is-number": "^7.0.0",
"is-positive-integer": "^1.1.1",
"is-url": "^1.2.4",
"js-seeder": "^1.0.1",
"nativescript-appavailability": "^1.3.2",
"nativescript-barcodescanner": "^3.4.2",
"nativescript-camera": "^4.5.0",
"nativescript-carousel": "^6.1.1",
"nativescript-effects": "^1.0.0",
"nativescript-image": "^3.0.5",
"nativescript-imagepicker": "^7.1.0",
"nativescript-iqkeyboardmanager": "^1.5.1",
"nativescript-masked-text-field": "^4.0.3",
"nativescript-phone": "^1.4.1",
"nativescript-plugin-firebase": "^10.5.2",
"nativescript-plugin-universal-links": "^1.0.1",
"nativescript-social-share": "^1.6.0",
"nativescript-ui-listview": "^8.1.0",
"nativescript-vibrate": "^3.0.0",
"tns-core-modules": "^6.5.1"
},
"devDependencies": {
"nativescript-dev-webpack": "^1.5.1",
"node-sass": "^4.13.1",
"sass-loader": "^8.0.2",
"typescript": "~3.5.3"
},
How do I install all of these dependencies? My node version is 8.9.4 and the NPM version is 5.6.0. Please don't ask why don't I have the latest. Please, suggest ways with NPM and not with HomeBrew etc.
I have even tried:
tns plugin add nativescript-platform
npm i
And possibly everything.
But this complains that nativescript-globalevents isn't found and when I install globalscripts, it complains platform isn't found!
I even tried adding modules one by one but it'd give me error all the time
npm install #proplugins/nativescript-globalevents#1.3.0 --save
This results in: npm ERR! 404 Not Found: #proplugins/nativescript-globalevents#1.3.0
Just an FYI: I already have the nativescript installed v6.8.0
Thanks!

It is because you are using a package from ProPlugins.
As per their site: ProPlugins is a curated, tested, documented, demo'd, highly supported group of NativeScript plugins; from the top trusted authors in the community.
You will need to pay them a subscription if you want to access their curated plugins.
The reason why you are getting the ERR! 404 Not Found: #proplugins/nativescript-globalevents#1.3.0 is because you don't have access to the private repository. Hence the status 400+.

Try $ tns install [--path]
--path - Specifies the directory which contains the package.json file, if different from the current directory.
For a specific module tns install <Module>
The documentation is https://docs.nativescript.org/tooling/docs-cli/project/configuration/install

Related

Expo/React native application crash on physical device trough APK installation

I'm currently building a React Native application with Expo. When running the application with the local server and the Expo Go application I dont have any issue. App run well on IOS and Android devices.
Now I'm trying to build an APK of the application for test purposes inside my team. To build it I followed [this documentation to use eas](https://docs.expo.dev/build-reference/apk/).
Now the apk install on the Android device but if I click on any button (they all trigger a navigate action onPress) the app crash instantly. I was using TouchableOpacity and I changed everyone of them to Pressable so the probleme does not come from the button. I'm wondering if i could come from the navigation system ?
Here is the dependencies of my project :
"dependencies": {
"#react-native-async-storage/async-storage": "^1.17.11",
"#react-navigation/native": "^6.1.1",
"#react-navigation/native-stack": "^6.9.6",
"#reduxjs/toolkit": "^1.9.1",
"#rneui/base": "^4.0.0-rc.7",
"#rneui/themed": "^4.0.0-rc.7",
"expo": "~47.0.13",
"expo-camera": "~13.1.0",
"expo-file-system": "~15.1.1",
"expo-location": "~15.0.1",
"expo-mail-composer": "~12.0.0",
"expo-media-library": "~15.0.0",
"expo-status-bar": "~1.4.2",
"jszip": "^3.10.1",
"react": "18.1.0",
"react-native": "0.70.5",
"react-native-safe-area-context": "4.4.1",
"react-native-screens": "~3.18.0",
"react-native-uuid": "^2.0.1",
"react-navigation": "^4.4.4",
"react-navigation-stack": "^2.10.4",
"react-redux": "^8.0.5",
"redux": "^4.2.0",
"redux-persist": "^6.0.0"
}
Thank you 🙏
Finally found the answer here
I forgot a GestureHandlerRootView at the root of my application 😅.

Expo EAS build android apk crash on physical device

I built eas -p android --profile luna. Then, I downloaded into physical device. When open it, the app crashes after showing splash screen. Expo SDK 45.0.0.
I tried to change eas.json profile. Here is what I tried.
"luna": {
"android": {
"buildType": "apk",
"distribution": "internal"
}
}
"luna": {
"android": {
"buildType": "apk",
"distribution": "internal",
"gradleCommand": ":app:assembleRelease"
}
}
"luna": {
"android": {
"buildType": "apk"
}
},
"luna": {
"android": {
"buildType": "apk",
"developmentClient": true
}
},
DevelopmentClient one can be opened but not the one I want.
Can someone tell or direct or advice me
How to build apk with eas for physical device
Should I downgrade to Expo SDK 44.0.0 and use expo build:android?
How to create apk for physical device without expo (like ejecting expo)
expo build classic build will be removed completely. Should I build react-native app without expo in the future?
my package.json file.
"dependencies": {
"#react-native-async-storage/async-storage": "~1.17.3",
"#react-native-community/datetimepicker": "6.1.2",
"#react-native-community/netinfo": "8.2.0",
"#react-native-masked-view/masked-view": "0.2.6",
"#react-navigation/material-top-tabs": "^6.2.1",
"#react-navigation/native": "^6.0.10",
"#react-navigation/stack": "^6.2.1",
"expo": "~45.0.0",
"expo-splash-screen": "~0.15.1",
"expo-sqlite": "~10.2.0",
"expo-status-bar": "~1.3.0",
"firebase": "^9.8.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-native": "0.68.2",
"react-native-collapsible": "^1.6.0",
"react-native-gesture-handler": "~2.2.1",
"react-native-modal-datetime-picker": "^13.1.2",
"react-native-pager-view": "5.4.15",
"react-native-safe-area-view": "^1.1.1",
"react-native-screens": "~3.11.1",
"react-native-svg": "12.3.0",
"react-native-web": "0.17.7",
"victory-native": "^36.4.1",
"expo-dev-client": "~0.9.6"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#types/react-native": "^0.67.7",
"babel-plugin-root-import": "^6.6.0"
},
You can try to log your errors. The first step I would recommend you to take is connecting your device (having USB debugging active) to your PC, go to where your adb is installed, open a CMD/PowerShell window in that folder, run adb logcat *:S ReactNative:V ReactNativeJS:V, and try to open the app that crashes to see what it logs when it does.
An issue that I've had was that there was a problem with some dependency that EAS was adding during the build, so I installed it (react-native-reanimated#^2.8.0) separately through npm i, and then my build worked with EAS.
as gusti mentioned you need to debug your application then you can locate the problem and fix it.
For me the problem was that I needed to install a package called "react-native-safe-area-context" by:
npm install react-native-safe-area-context then run expo doctor --fix-dependencies to make it compatible with your sdk version.
or directly run expo install react-native-safe-area-context
if it didn't work try to run expo update it will upgrade the sdk version and reinstall all the packages to make them compatible with the new version.
This was my problem you might face a different one, but you just need to read the error message and fix it.
To see just the log of your app with adb, use:
adb logcat -e "appname"
You can also filter Errors:
adb logcat -e "appname" | grep Error

React Native Built App is closing unexpectedly

Okay, I've been struggling for the last two days and this is it. I'm developing my first React Native android app using React Native CLI and using the following Packages:
"dependencies": {
"#react-native-masked-view/masked-view": "^0.2.6",
"#react-navigation/drawer": "^6.3.1",
"#react-navigation/material-bottom-tabs": "^6.1.1",
"#react-navigation/material-top-tabs": "^6.1.1",
"#react-navigation/native": "^6.0.8",
"#react-navigation/stack": "^6.1.1",
"react": "17.0.2",
"react-native": "0.67.3",
"react-native-gesture-handler": "^2.3.2",
"react-native-immersive": "^2.0.0",
"react-native-linear-gradient": "^2.5.6",
"react-native-material-textinput": "^1.3.0",
"react-native-pager-view": "^5.4.15",
"react-native-paper": "^4.11.2",
"react-native-reanimated": "^2.4.1",
"react-native-safe-area-context": "^4.2.1",
"react-native-screens": "^3.13.1",
"react-native-svg": "^12.3.0",
"react-native-tab-view": "^3.1.1",
"react-native-vector-icons": "^9.1.0"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#babel/runtime": "^7.12.5",
"babel-jest": "^26.6.3",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.66.2",
"react-native-svg-transformer": "^1.0.0",
"react-test-renderer": "17.0.2"
},
In the Development mode, The App works just fine and smooth. I'm developing the app without any errors. But, When I built the app for production into aab and apk files, the issue arises. If I run the app, whether via npx react-native run-android --variant=release or installing the app on my physical device, the app just close instantly after opening. Here's the GitHub Repo Link
Note: I'm developing the app in Windows 10 with the latest Android Studio and all the latest versions of dependencies.
Preview: App on Production Mode
Preview: App on Development Mode
Please run the app in the simulator with LogCat running and check the error message there. That should give some indication, like this it could be anything. If logcat does not automatically run in your android studio you can open a terminal and run:
adb logcat
The problem was in my android/app/build.gradle file. I've changed following values:
def enableProguardInReleaseBuilds = false
def enableSeparateBuildPerCPUArchitecture = false
universalApk false
If I keep those unchanged, the builds work perfectly and smoothly. Can anyone please describe the reason?
This issue can occur due to variations from libs version incompatibilities, missing files and configuration...
In my case it was a missing key in file in:
Info.plist
<key>NSUserTrackingUsageDescription</key>
<string>$(PRODUCT_NAME) requires your permission to track in order to show you more relevant ads.</string>
Try looking at the simulator error log..

Google Play will deny the use of location in the background (Warning Email), Expo React native

We have received an email from google play, where it warns us that one of our apps is using localization in the background, and we have to change that before next year, but I already checked the app and I'm not using localization in the background.
This is the email
Is this happening to someone else? I don't know what to do because they ask me to remove that service but I'm not really using it
this is my package.json (dependencies I'm using )
"dependencies": {
"#react-native-community/datetimepicker": "2.4.0",
"#react-native-community/masked-view": "0.1.10",
"#react-navigation/native": "^5.1.6",
"#react-navigation/stack": "^5.2.11",
"axios": "^0.19.2",
"babel-runtime": "^6.26.0",
"big-integer": "^1.6.48",
"expo": "^38.0.0",
"expo-barcode-scanner": "~8.2.1",
"expo-crypto": "~8.2.1",
"expo-file-system": "~9.0.1",
"expo-media-library": "~8.2.1",
"expo-sharing": "~8.2.1",
"firebase": "7.9.0",
"react": "16.11.0",
"react-dom": "16.11.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz",
"react-native-animatable": "^1.3.3",
"react-native-camera": "^3.23.1",
"react-native-fs": "^2.16.6",
"react-native-gesture-handler": "~1.6.0",
"react-native-picker-select": "^7.0.0",
"react-native-qrcode-scanner": "^1.4.0",
"react-native-qrcode-svg": "^6.0.6",
"react-native-reanimated": "~1.9.0",
"react-native-responsive-screen": "^1.4.1",
"react-native-safe-area-context": "~3.0.7",
"react-native-screens": "~2.9.0",
"react-native-sha256": "^1.3.6",
"react-native-share": "^3.3.0",
"react-native-svg": "12.1.0",
"react-native-vector-icons": "^6.6.0",
"react-native-web": "~0.11.7",
"react-navigation": "^4.3.7",
"rn-fetch-blob": "^0.12.0"
},
please refer to this docs page: https://docs.expo.io/distribution/app-stores/#android-permissions
Permissions are configured via the android.permissions key in your app.json file
By default, your app will include all permissions supported by Expo. This is so that your standalone app will match its behavior in the Expo client and simply "work out of the box" no matter what permissions you ask for, with hardly any configuration needed on your part.
There are some drawbacks to this. For example, let's say your To-do list app requests CAMERA permission upon installation. Your users may be wary of installing since nothing in the app seems to use the camera, so why would it need that permission?
To remedy this, simply add the android.permissions key in your app.json file, and specify which permissions your app will use. A list of all Android permissions and configuration options can be found here.
To use only the minimum necessary permissions that Expo requires to run, set "permissions" : []. To use those in addition to CAMERA permission, for example, you'd set "permissions" : ["CAMERA"].
Try this :
By default, expo adds all permission in the app manifest. To remove all permission
add "permissions" : [] in your app.json file
keep it empty []
example :
"android": {
"package": "com.sahilnetic.appmojo",
"versionCode": 1,
"permissions" : []
},
now run
expo build:android -t app-bundle
then upload the bundle to the google play store

"Property description must be an object error" in non debug mode while executing command react-native run-android

I have this react-native project and its been running fine for the past 2 months but now I am getting an error "Property description should be and object" while running the build on android in a non-debug mode. It works very well in debug-mode and on IOS. Can somebody please guide? here is my package.json
Tried downgrading redux to 4.0.0 and put resolutions for babel in package.json. But nothing works and the error persists.
"react-native": "0.58.4",
"react-native-action-picker": "^1.0.2",
"react-native-base64": "0.0.2",
"react-native-cli": "^2.0.1",
"react-native-color-palette": "^2.0.2",
"react-native-confirmation-code-input": "^1.0.4",
"react-native-customized-image-picker": "^0.1.5",
"react-native-vector-icons": "^6.6.0",
"react-navigation": "^2.14.2",
"react-redux": "^6.0.1",
"redux": "^4.0.1",
"redux-logger": "^3.0.6",
"redux-persist": "^5.10.0",
"redux-promise": "^0.6.0",
"redux-thunk": "^2.3.0",
update npm. redux 4.0.4 work for me
[Just a workaround in case you can't afford to update dependency]
I got the same error in redux, I solved it.
Simply go to: node_modules/redux/lib/redux.js
and replace the line:
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(arguments[i], key));
to this:
var descriptor = Object.getOwnPropertyDescriptor(arguments[i], key);
if (descriptor) {
Object.defineProperty(target, key, descriptor);
}

Categories

Resources