a7medev / react-native-ml-kit

React Native On-Device Machine Learning w/ Google ML Kit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

App crash after installing the package in android

DeepikaSharma5 opened this issue · comments

What happened?

I insalled the package using npm like this
npm install @react-native-ml-kit/image-labeling --save

It is making the app crash. The I tried to link the main branch directly to package,json like this
"@react-native-ml-kit/image-labeling": "https://github.com/a7med-mahmoud/react-native-ml-kit/tree/main/image-labeling#main",

That doesn't event install

Version

1.2.0

Which ML Kit packages do you use?

  • @react-native-ml-kit/barcode-scanning
  • @react-native-ml-kit/face-detection
  • @react-native-ml-kit/identify-languages
  • @react-native-ml-kit/image-labeling
  • @react-native-ml-kit/text-recognition
  • @react-native-ml-kit/translate-text

What platforms are you seeing this issue on?

  • Android
  • iOS

System Information

System: OS: Windows 10 10.0.22000 CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-11370H @ 3.30GHz Memory: 3.95 GB / 15.74 GB Binaries: Node: 16.15.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.18 - C:\Program Files\nodejs\yarn.CMD npm: 8.5.5 - C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: Not Found Windows SDK: Not Found IDEs: Android Studio: Version 2021.1.0.0 AI-211.7628.21.2111.8193401 Visual Studio: Not Found Languages: Java: 11.0.15.1 - C:\Program Files\Common Files\Oracle\Java\javapath\javac.EXE npmPackages: @react-native-community/cli: Not Found react: 18.0.0 => 18.0.0 react-native: 0.69.4 => 0.69.4 react-native-windows: Not Found npmGlobalPackages: *react-native*: Not Found

Steps to Reproduce

Install the package using npm install @react-native-ml-kit/image-labeling --save
Try run the project using npm run android

Thanks for reporting this issue @DeepikaSharma5, I'll look into it and let you know.

Can you share the error that you see so I can better understand the problem?

@a7med-mahmoud That's the main issue. I don't see any errors, warnings or info. Just when you install the package and run the project the app is crashing. There is no information in the console.

Any update @a7med-mahmoud ?

I created a new React Native 0.69.4 app and installed @react-native-ml-kit/image-labeling and ran the app on Android and it does work properly.
What Android API of the emulator are you using?

I am also using the same react -native version. And I am running on a real device (Samsung galaxy A03)

I tried everything I could. I clean the project and rebuilt it, Deleted the node modules and re installed it. But nothing works for me.

Does it work when you uninstall it?

Yes. My app is working fine before install the package and after uninstall it

These are the other packages I am using. May be @react-native-ml-kit/image-labeling is not supported when one of these package is installed....

`"dependencies": {

"@miblanchard/react-native-slider": "^2.1.0",
"@react-native-community/masked-view": "^0.1.11",
"@react-native-community/netinfo": "^9.3.0",
"@react-navigation/bottom-tabs": "^6.3.3",
"@react-navigation/native": "^6.0.12",
"axios": "^0.27.2",
"react": "18.0.0",
"react-native": "0.69.4",
"react-native-app-intro-slider": "^4.0.4",
"react-native-circular-progress-indicator": "^4.4.0",
"react-native-fs": "^2.20.0",
"react-native-gesture-handler": "^2.5.0",
"react-native-image-crop-picker": "^0.38.0",
"react-native-image-pan-zoom": "^2.1.12",
"react-native-pager-view": "^5.4.25",
"react-native-progress": "^5.0.0",
"react-native-reanimated": "^2.10.0",
"react-native-safe-area-context": "^4.3.3",
"react-native-screens": "^3.16.0",
"react-native-svg": "^13.1.0",
"react-native-tab-view": "^3.1.1",
"react-native-uuid": "^2.0.1",
"react-native-vector-icons": "^9.2.0",
"react-native-vision-camera": "^2.14.1",
"vision-camera-face-detector": "https://github.com/DeepikaSharma5/vision-camera-face-detector#master",
"vision-camera-image-labeler": "^0.1.6"

},`

` "devDependencies": {

"@babel/core": "^7.12.9",
"@babel/runtime": "^7.12.5",
"@react-native-community/eslint-config": "^2.0.0",
"@tsconfig/react-native": "^2.0.2",
"@types/jest": "^26.0.23",
"@types/react-native": "^0.69.3",
"@types/react-native-vector-icons": "^6.4.11",
"@types/react-test-renderer": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5.29.0",
"@typescript-eslint/parser": "^5.29.0",
"babel-jest": "^26.6.3",
"eslint": "^7.32.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.70.3",
"react-test-renderer": "18.0.0",
"typescript": "^4.4.4"

},`

Most likely it's conflicting with vision-camera-image-labeler since they both depend on the com.google.mlkit:image-labeling Android package. Looking at their GitHub repo. RN ML Kit uses version 17.0.7 while Vision Camera uses version 17.0.5.

Oh I'll try removing that package and use @react-native-ml-kit/image-labeling directly. But will this package work for iOS also? (Because vision-camera-image-labeler is not working well with iOS)

Yes, it will. Let me know if you have any issues.

Sure. I'll update you soon. Thankyou for your support

Hi. I uninstalled vision-camera-image-labeler and checked. But still the app is crashing without and error or warning message

I think the issue is vision-camera-face-detector. That is also using RN ML Kit. That's why it's conflicting

Is it working now after removing conflicting packages?

@a7med-mahmoud I think it will work. I need to chage a lot of code if I remove that package. I am working on that.

But when I tried your face detection example project I am getting the values like this.
image

Can I know why the contours value is always showin as this without value.

What do you mean by shown like this? You mean that "Object" thing in the values?
Can you try printing it with this instead?

console.log(JSON.stringify(result, null, 2));

Oh sorry I mistakenly passed the faces value. I'll remove other conflice packages and try both these packages. I'll check it in android and IOS and let you know. Thankyou for the support 😃