Hi Eugene,
Recently I have successfully connected Fabric and Crashlytics using the new Java Binding Generator. It’s working correctly, I have just one small issue with the Crashlytics raport - @PaulS custom ExceptionHandler is not working for me.
I’ve used the iOS native Fabric and Crashlytics pods:
- Install CocoaPods on your computer
sudo gem install cocoapods
- In terminal proceed to the xcode project directory and create new pod file
pod init
- Edit Podfile - use frameworks and set target to 9.0. Then save the file.
vim Podfile
platform :ios, 9.0
use_frameworks!
target 'MyTarget' do
# Pods for MyTarget
pod 'Fabric'
pod 'Crashlytics'
end
- Force remove the xcode configurations for your targets
Project navigator > Project > Info > Configurations
Set all to ‘None’
More on: http://stackoverflow.com/questions/26287103/cocoapods-warning-cocoapods-did-not-set-the-base-configuration-of-your-project/33509278#33509278
5) Quit xcode!
6) Ensure that xcode is not running!
Note: Running xcode will cause problems during pod installing. If you had your xcode running and you are having problems - try repeating this tutorial after removing all files modified by pod install.
- Install all pods from the Podfile - go to Podfile dir in terminal and type:
pod install
- Change build settings in xcode
Project navigator > Targets > MyTarget > Build Phases > Link Binary With Libraries
- Link your new pods. If you cannot find them try:
New > Add Other > ios > xcode > Pods > Fabric > iOS > Fabric.framework
-
Some libraries are needed extra for Fabric and Crashlytics (if you won’t have them you will get later an error and then find the needed libraries in some StackOverflow answers ):
-
Add your API key (after creating a Fabric account you will find it here: https://fabric.io/kits/ios/crashlytics/install)
Remember to do all steps from Add a Run Script Build Phase and Add Your API Key.
-
Add -ObjC
to your linker flags:
Project > Targets > MyTarget > Build settings > Linking > Other Linker Flags
Double click and add new flag -ObjC
- If building through xcode is passing then proceed to Android Studio. Right click on project and do
MOE Actions > Create New Bindings
- Create .nbc file and proceed to form. In new window select
Header
and fill the form as below:
Name: <YOUR_POD_NAME>
Header path: xcode/Pods/<YOUR_POD_NAME>/<YOUR_POD_NAME>
(or another path to pod headers)
Base package name: com.yourapp.ios.pods.<YOUR_POD_NAME>
Import headers:
#import "<YOUR_POD_HEADER_FILE>.h"
(same as the objc import added in native pod usage)
-
Click on gear icon and click Generate bindings. The IDE will now freeze (@kisg ;)) and after a while it should generate Java classes in com.yourapp.ios.pods.<YOUR_POD_NAME>
-
In your main class make sure that you initialize them correctly:
@Override
public boolean applicationDidFinishLaunchingWithOptions(UIApplication application, NSDictionary launchOptions) {
Fabric.with(NSArray.arrayWithObject(Crashlytics.class_objc_static()));
return true;
}
The only issue I have is that all my reports is grouped in a single one:
Which have different exceptions inside:
I’m not sure why the @PaulS custom exception handler is not working here.
Let me know if I can help you with any more issues!