-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[Android] undefined is not an object (evaluating 'RNFetchBlob.DocumentDir') #51
Comments
Hi @dphov , It looks like your package is not linked properly, did you restart your packager after install the package ? the module has many native code so you have to rebuild the project after install it. |
Hi @wkh237 ,
And I got the same error |
Did you save the package dependency to could you try the following commands ?
|
package.json after running commands got same error again |
This may also related to changes in @Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
// Add this line if it does not exists
+ new RNFetchBlobPackage()
);
} Add the missing package and compile to see if it work 👍 |
|
Hurray! It works! Thank you! |
That's great 👍 Please feel free file an issue if something's going wrong 😄 |
Sure! 😄 👍 |
Commenting just in case anyone encounter the same issue when compiling IOS. I have also encountered this when I transfer my project to a new macbook. Solution: Credits to this link: http://stackoverflow.com/questions/35611765/react-native-run-ios-command-fails-pch-issues-but-build-succeeds-in-xcode |
@shirleycharlin , great thanks for your additional information 👍 |
I am still having this same issue @dphov reported, I have done the linking but the error persists on Android. Is there any other reason RNFetchBlob will be undefined? Cos I get error
|
@RichardBoyewa , I've write some instructions in other thread, let's discuss this issue here, Thank you: ) |
I'm getting the error not able to find the symbol RNFetchBlobPackage after adding the package in main application |
before that i was getting the error undefined is not an object (evaluating 'RNFetchBlob.DocumentDir') |
Two things solved the problem for me: |
@dphov "dependencies": { |
newbies? read this post. https://blog.nativebase.io/adding-third-party-native-modules-using-react-native-cbcb9e3786ba |
@wkh237 @shirleycharlin I got the same issue when compiling IOS, but it work when compiling Android.I follow your steps to solve, but still not work. dependencies: Compile Error: The following build commands failed: Installing build/Build/Products/Debug-iphonesimulator/RNDemo.app Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/RNDemo.app/Info.plist |
For future posterity: I also ran into this problem because I was accidentally still running a React packager for a different project. I assume they got their wires crossed somehow. Not sure if it's expected to be able to run 2 packagers side-by-side or not? |
If you are making a Activity and implementing DefaultHardwareBackBtnHandler, then in your
|
After linking you need to run |
This is solution for Android build. I didn't have any issues with iOS, some of these steps might help for iOS as well. First make sure the package is installed
Next make sure it's included your package.json file (your version number might be different, just make sure it's there)
Next link the react-native-fetch-blob package directly using
Next verify that the package is included in
Try to build the project. If you get an error
to the top with the other imports. Try to build and it should work. All these steps ended up working for me and the project was built. |
Hello!
This error appears at start launch in the simulator/device.
In my example I'm trying implement this part of code, how we can avoid this issue?
Thank you in advance.
componentDidMount() { RNFetchBlob .config({ // add this option that makes response data to be stored as a file, // this is much more performant. fileCache : true, }) .fetch('GET', 'https://homepages.cae.wisc.edu/~ece533/images/mountain.png') .then((res) => { // the temp file path console.log('The file saved to ', res.path('/')) }) requestPermission("android.permission.ACCESS_FINE_LOCATION").then((result) => { console.log("Granted!", result);// now you can set the listenner to watch the user geo location }, (result) => { console.log("Not Granted!"); console.log(result); });
react-native@0.29.0
react-native-cli@1.0.0
react@15.2.0
react-native-fetch-blob@0.6.3-dev.1
The text was updated successfully, but these errors were encountered: