react-native-tensorflow icon indicating copy to clipboard operation
react-native-tensorflow copied to clipboard

can not load resoure in release apk

Open JiangWeixian opened this issue 6 years ago • 10 comments

I follow the code in your example, it work fine when i react-native run-android

But,when i build in release version。

error, can't load resource

react-native bundle --entry-file App.js --platform android --dev false --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/src/main/res/

I use App.js as my entry file not index.js

and genkey, set it in some file

adb install release.apk

success install, but can't load release when i open it

JiangWeixian avatar May 19 '18 02:05 JiangWeixian

i change entry file into index.js, i get the same error

JiangWeixian avatar May 19 '18 02:05 JiangWeixian

Same issue. The .pb file is not loaded in release APK and hence error caught when using react-native-camera following takePictureAsync for tfImageRecognition screenshot_20180525-201521

aryaminus avatar May 25 '18 14:05 aryaminus

Are you following this guide to create the apk: https://facebook.github.io/react-native/docs/signed-apk-android.html ? I am asking because you should not need to require to do react-native bundle yourself anymore as it is done when running gradlew assembleRelease. Also, can you try to run react-native run-android --variant=release and see if that works?

reneweb avatar Jun 05 '18 22:06 reneweb

Followed the Signed APK guide along with react-native run-android --variant=release. No success. The gradle is 3.0.1 if that matters at all

aryaminus avatar Jun 06 '18 13:06 aryaminus

I have pushed a fix that might help - can you update to version 0.1.8 and see if that helps

reneweb avatar Jun 09 '18 01:06 reneweb

Same issue with the release variant

aryaminus avatar Jun 12 '18 02:06 aryaminus

Do check the repo: https://github.com/aryaminus/nazar where the react-native-tensorflow has been used for real time analysis

aryaminus avatar Jun 12 '18 11:06 aryaminus

same issue here, any solutions?

leduykhanh avatar Aug 02 '18 04:08 leduykhanh

place the graph.pf file in the assets folder

=> android/app/src/main/assets/graph.pb

now you can access it like this:

const tf = new Tensorflow('file://graph.pb');

it works for me. and yes, the file uri is correct file://something

according to this commit: https://github.com/reneweb/react-native-tensorflow/commit/5e3893082995f1a34ce542f575e1e3ef29695302 if(resource.startsWith("file://")) { return loadFromLocal(resource.substring(7));

Isti01 avatar Aug 02 '18 22:08 Isti01

I solve this problem by myself. The solution is in StackOverflow (in Brazilian Portuguese): https://pt.stackoverflow.com/questions/339929/erro-ao-implementar-o-tensorflow-em-react-native/341411#341411

jpdesignerrio avatar Nov 06 '18 13:11 jpdesignerrio