Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.String cannot be cast to java.lang.Double #218

Closed
3 tasks done
szyymoon opened this issue Aug 16, 2021 · 3 comments
Closed
3 tasks done

java.lang.String cannot be cast to java.lang.Double #218

szyymoon opened this issue Aug 16, 2021 · 3 comments
Assignees

Comments

@szyymoon
Copy link

szyymoon commented Aug 16, 2021

  • Asked question in discussions
  • Tried the troubleshooting Wiki
  • Followed the migration Wiki

Describe the bug
After npm i react-natove-dotenv and set it out I'am getting this error> java.lang.String cannot be cast to java.lang.Double. Stacktrace is very long. App is immediately crashing. Belong some first lines and link to full view.

E/unknown:ReactNative: Exception in native call
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Double
at com.facebook.react.bridge.ReadableNativeArray.getDouble(ReadableNativeArray.java:92)
at com.facebook.react.bridge.JavaMethodWrapper$2.extractArgument(JavaMethodWrapper.java:46)
at com.facebook.react.bridge.JavaMethodWrapper$2.extractArgument(JavaMethodWrapper.java:42)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:356)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:151)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
at android.os.Looper.loop(Looper.java:223)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
at java.lang.Thread.run(Thread.java:923)

my .babelrc:

{
"presets": ["module:metro-react-native-babel-preset"],

"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }],
[
"transform-remove-console",
{ "exclude": ["error", "warn", "log", "tron", "tron.log", "tron.error"] }
],
[
"module:react-native-dotenv",
{
"moduleName": "@env",
"path": ".env",
"safe": true,
"allowUndefined": false,
"verbose": false
}
]
],

"env": {
"production": {
"plugins": ["react-native-paper/babel"]
}
}
}

My package.json:

{
"name": "test",
"version": "0.9.91",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"start-reset": "npx react-native start --reset-cache",
"test": "jest",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"gradlew-clean": "cd .\android && .\gradlew clean && cd ..",
"adb": "adb reverse tcp:9090 tcp:9090 && adb reverse tcp:3000 tcp:3000 && adb reverse tcp:9001 tcp:9001 && adb reverse tcp:8081 tcp:8081"
},
"dependencies": {
"@callstack/react-theme-provider": "^3.0.6",
"@react-native-community/datetimepicker": "^2.6.0",
"@react-native-community/masked-view": "^0.1.10",
"@react-native-community/netinfo": "^5.9.6",
"@react-navigation/native": "^5.7.3",
"@react-navigation/stack": "^5.9.0",
"@types/react-native-dotenv": "^0.2.0",
"axios": "^0.21.1",
"currency.js": "^2.0.3",
"formik": "^2.1.4",
"i18n-js": "^3.7.0",
"iso-8859-2": "^1.0.0",
"jail-monkey": "^2.3.3",
"js-base64": "^3.6.0",
"jwt-decode": "^3.0.0-beta.2",
"moment": "^2.27.0",
"qrcode": "^1.4.4",
"react": "17.0.1",
"react-native": "0.64.0",
"react-native-advertising-id": "^1.0.11",
"react-native-apk-installer-n": "^2.1.2",
"react-native-background-timer": "^2.4.1",
"react-native-barcode-builder": "^2.0.0",
"react-native-ble-manager": "^7.4.1",
"react-native-calendars": "^1.300.0",
"react-native-crk-integration": "my private repo and package",
"react-native-device-info": "8.1.3",
"react-native-dotenv": "^3.2.0",
"react-native-ecr-integration": "my private repo and package",
"react-native-elements": "^3.0.1",
"react-native-exit-app": "^1.1.0",
"react-native-fs": "^2.16.6",
"react-native-gesture-handler": "^1.6.1",
"react-native-html-to-pdf": "^0.8.0",
"react-native-image-crop-picker": "^0.33.4",
"react-native-image-picker": "^2.3.4",
"react-native-keyboard-aware-scroll-view": "^0.9.2",
"react-native-localize": "^1.4.0",
"react-native-masked-text": "^1.13.0",
"react-native-mmkv": "^1.1.6",
"react-native-modal": "^11.5.6",
"react-native-modal-datetime-picker": "^8.7.1",
"react-native-paper": "^4.7.2",
"react-native-print": "^0.8.0",
"react-native-qrcode-svg": "^6.1.1",
"react-native-reanimated": "~2.0.0",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "^3.0.0",
"react-native-send-intent": "^1.2.3",
"react-native-sensitive-info": "^5.5.8",
"react-native-size-matters": "^0.3.0",
"react-native-sound-player": "^0.10.9",
"react-native-sqlite-storage": "my private repo",
"react-native-svg": "^12.1.1",
"react-native-tab-view": "^2.14.4",
"react-native-tcp-socket": "^4.5.4",
"react-native-text-ticker": "^1.13.0",
"react-native-toast-message": "^1.4.9",
"react-native-udp": "^4.1.2",
"react-native-vector-icons": "^6.6.0",
"react-redux": "^7.2.0",
"redux": "^4.0.5",
"redux-saga": "^1.1.3",
"reflect-metadata": "^0.1.13",
"sp-react-native-in-app-updates": "^0.1.2",
"string_decoder": "^1.3.0",
"typeorm": "my private repo",
"url": "^0.11.0",
"util": "^0.12.3",
"yup": "^0.29.1"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/plugin-proposal-decorators": "^7.10.1",
"@babel/runtime": "^7.12.5",
"@react-native-community/eslint-config": "^2.0.0",
"@types/i18n-js": "^3.0.3",
"@types/jest": "^25.2.3",
"@types/jwt-decode": "^2.2.1",
"@types/node": "^14.0.13",
"@types/qrcode": "^1.3.5",
"@types/react": "~16.9.35",
"@types/react-native": "^0.62.2",
"@types/react-native-background-timer": "^2.0.0",
"@types/react-native-html-to-pdf": "^0.8.0",
"@types/react-native-vector-icons": "^6.4.5",
"@types/react-redux": "^7.1.9",
"@types/react-test-renderer": "16.9.2",
"@types/yup": "^0.29.2",
"@typescript-eslint/eslint-plugin": "^3.2.0",
"@typescript-eslint/parser": "^3.2.0",
"babel-jest": "^26.6.3",
"babel-plugin-transform-remove-console": "^6.9.4",
"eslint": "7.14.0",
"eslint-plugin-react-hooks": "^4.0.4",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.64.0",
"prettier": "^2.0.5",
"react-test-renderer": "17.0.1",
"reactotron-react-native": "^5.0.0",
"reactotron-redux": "^3.1.3",
"reactotron-redux-saga": "^4.2.3",
"typescript": "^3.9.5"
},
"jest": {
"preset": "react-native",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
]
}
}

To Reproduce
Steps to reproduce the behavior:

  1. install react-native-dotenv by npm
  2. npm run android
  3. wait for bundle of js
  4. See error

Expected behavior
Application work well with react-native-dotenv installed.

Screenshots
Screen -> https://drive.google.com/file/d/1jDB6mjLsGLq7AyLz8WdE-GFgZaFiyMTs/view?usp=sharing
FULL STACK -> https://drive.google.com/file/d/1dA8ndmL9ld5LftETz12F7L8x6Z5keBhL/view?usp=sharing

Desktop (please complete the following information):

  • OS: MacOS Big Sur
  • Version 11.5.1

Smartphone (please complete the following information):

  • Device: Emulator of Nexus 5
  • OS: Android 11 with Google Play Services API 30
  • Version react native 64.0 / react 17.0.1
@github-actions
Copy link

Hey, thank you for opening this issue! 🙂 To boost priority on this issue and support open source please tip the team at https://issuehunt.io/r/goatandsheep/react-native-dotenv/issues/218

@szyymoon szyymoon reopened this Aug 19, 2021
@github-actions
Copy link

Hey, thank you for opening this issue! 🙂 To boost priority on this issue and support open source please tip the team at https://issuehunt.io/r/goatandsheep/react-native-dotenv/issues/218

@szyymoon
Copy link
Author

There was my mistake. I Totatly didint know that any value from env is a String value.
Basicly I found place where I pass value that should be number but after get from env it is representet as string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants