-
Notifications
You must be signed in to change notification settings - Fork 787
Manually Link Package
Open android/app/build.gradle
, add this line
dependencies {
...
+ compile project(':react-native-fetch-blob')
}
Open android/settings.gradle
, and add these lines which will add RNFetchBlob Android project dependency to your app.
include ':app'
+ include ':react-native-fetch-blob'
+ project(':react-native-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fetch-blob/android')
Add these lines to MainApplication.java
, so that RNFetchBlob package becomes part of react native package.
...
+ import com.RNFetchBlob.RNFetchBlobPackage;
...
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
+ new RNFetchBlobPackage()
);
}
};
...
For projects < 0.28
React Native has changed OkHttp version in 0.27, if your project is older than 0.28 you have to explicitly specify OkHttp version in node_modules/react-native-fetch-blob/android/build.gradle
dependencies {
compile 'com.facebook.react:react-native:+'
+ compile 'com.squareup.okhttp3:okhttp:3.4.1'
- //{RNFetchBlob_PRE_0.28_DEPDENDENCY}
}
If you still having problem on installing this package, please check the trouble shooting page or file an issue
Since React Native has changed the way IOS 3rd party IOS native packages import core modules. You should remove this line in react-native-fetch-blob/ios/RNFetchBlob/RNFetchBlob.h
:
// comment out this line if your RN project >= 0.40
- #define OLD_IMPORT
This is only available in react-native-fetch-blob
>= 0.10.2 otherwise you will need to change every #import "RCT*.h"
to #import <React/RCT*.h>
yourself.
For example
- #import "RCTLog.h"
+ #import <React/RCTLog.h>
- #import "RCTRootView.h"
+ #import <React/RCTRootView.h>
- #import "RCTBridge.h"
+ #import <React/RCTBridge.h>
- #import "RCTEventDispatcher.h"
+ #import <React/RCTEventDispatcher.h>
Open Xcode expand your project in navigator and right click Libraries
, select Add files to ..
Select node_modules/react-native-fetch-blob/ios/RNFetchBlob.xcodeproj
Click your project in navigator, select your project in TARGET, then click General
Click + sign
under Linked Frameworks and Libraries
Select and add libRNFetchBlob.a