Crash Reporting

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:

  1. Install CocoaPods on your computer
sudo gem install cocoapods
  1. In terminal proceed to the xcode project directory and create new pod file
pod init
  1. 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
  1. 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.

  1. Install all pods from the Podfile - go to Podfile dir in terminal and type:
pod install
  1. Change build settings in xcode
Project navigator > Targets > MyTarget > Build Phases > Link Binary With Libraries
  1. Link your new pods. If you cannot find them try:
New > Add Other > ios > xcode > Pods > Fabric > iOS > Fabric.framework
  1. 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 :wink: ):

  2. 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.

  3. Add -ObjC to your linker flags:

Project > Targets > MyTarget > Build settings > Linking > Other Linker Flags

Double click and add new flag -ObjC

  1. If building through xcode is passing then proceed to Android Studio. Right click on project and do
MOE Actions > Create New Bindings
  1. 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)
  1. 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>

  2. 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!

5 Likes