-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Not able to use smart-reply feature in react-native-firebase/@react-native-firebase/ml-natural-language #2478
Comments
Please check out: https://invertase.io/oss/react-native-firebase/v6/ml-natural-language/reference/module#suggestReplies Since that tweet, we have changed the API around and removed the builder classes. It won't change again :) |
@Ehesp Hi, Ehesp, Thanks for the heads up, but I do mentioned in the issue that when I use the same code to invoke the smartreply feature as shown in the documentation with the link you posted,
but it shows the following error, it does show as yellow box instead of red screen on device, but if you check the react-native log, it shows following error. I have tried all @react-native-firebase/ml-natural-language package version above 0.1.0, shows the same result, is there any step I missed? or any configuration about dependencies is wrong? Would you mind to reopen this issue and have a look on it? |
Walk through these steps:
If it still errors let me know and I'll re-open. |
Hello, @Ehesp, I have tried those solution, even with latest version 0.2.3 (0.1.3 ~ 0.1.5 as well), still not work.
I have attached the information in the following.
MySmartReply.js
main App.js
PS 1: I have tried auto-link and manual-link the packages, but none of them worked, shows the same error. Would you mind re-open this issue and check is there anything I did wrong? Many thanks |
Hi, @Ehesp , I think this might be the solution to this problem, but it still requires your test to verify this if you can. My solution is: Add following content in the app-level build.gradle file, rebuild Android project and run again.
The reason behind this is the react-native successfully build and link the native Android SmartReply library, and the native module try to load the target .tflite file in the assets directory. But this file is actually compressed in a .aar file (which is the native Java smartreply library), which causes “file not found” problem: By setting the non-compression configuration, the .tflite file stores as a standalone file in the assets, no compression is applied, so the framework/library could load the file properly. If you test this and consider this as a solution, it would be better to update your documentation on Android Setup page. Many thanks. |
Those aaptOptions are in the v6 build.gradle for the tests app, seems on target |
@Salakar any idea on this? |
@Ehesp ye, the noCompress option needs adding to the docs as we cant automate this part as far as I know. |
The right way to do this (I think, with social proof via a bunch of modules) is to have a gradle file you ask people to include: https://github.com/oblador/react-native-vector-icons#android |
(then you can make changes etc but people only have to fiddle with it once) |
Hello 👋, to help manage issues we automatically close stale issues.
|
I like that idea @mikehardy - I think we should apply this fix that way then instead of documentation, can put the gradle file in |
react-native-background-geolocation (and it's licensed/paid release version react-native-background-geolocation-android) just converted to this "import a gradle file" style as well. And now that I think about it, react-native and react-native-cli do it as well. Seems much more robust |
I've added it to the template to be there by default, could do with some documentation for non-template users also. We can look at including an import gradle file in a later build once RN CLI auto-linking supports it (react-native-community/cli@master...bartolkaruza:feature/custom-gradle-script-option - we hacked on this together in France a couple weeks back) |
Oooo! I know at least a couple modules (vector-icons and background-geolocation) that could use this feature, nice! |
Just need to find some time to get https://github.com/bartolkaruza/cli/tree/feature/custom-gradle-script-option up as a PR, unless someone beats me or @bartolkaruza to it 😅 |
Closing due to inactivity. |
Issue
Describe your issue here
I am trying to use the smartreply feature according to https://twitter.com/mikediarmid/status/1128838915878805508
#2117
I try to use the code in react-native-firebase/tests/app.smartreply.js
But the error shows on emulator as:
my package.json shows:
Then I tried with another approach following this instruction: https://invertase.io/oss/react-native-firebase/v6/ml-natural-language/reference/module
But it still shows error:
I setup my firebase.json
wit following content
Can anyone update a proper documentation to achieve the example on the twitter?
Project Files
iOS
Click To Expand
ios/Podfile
:# N/A
AppDelegate.m
:// N/A
Android
Click To Expand
Have you converted to AndroidX?
android/gradle.settings
jetifier=true
for Android compatibility?jetifier
for react-native compatibility?android/build.gradle
:android/app/build.gradle
:android/settings.gradle
:MainApplication.java
:AndroidManifest.xml
:<!-- N/A -->
Environment
Click To Expand
react-native info
output:react-native-firebase
version you're using that has this issue:e.g. 5.4.3
Firebase
module(s) you're using that has the issue:e.g. Instance ID
TypeScript
?Y/N
Think
react-native-firebase
is great? Please consider supporting all of the project maintainers and contributors by donating via our Open Collective where all contributors can submit expenses. [Learn More]React Native Firebase
andInvertase
on Twitter for updates on the library.The text was updated successfully, but these errors were encountered: