Crashlytics cocos2dx 3.7 + Android Studio

It seems you didnt imported in appactivity fabric sdk? Show your appactivity

I didnā€™t make any changes in the appactivity, I imported the fabric sdk in Cocos2dxActivity and used this line of code there:

protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fabric.with(this, new Crashlytics(), new CrashlyticsNdk());

So, I should have imported the fabric sdk in appactivity then ? And how should I use the above fabric code ?

Make same oncreate function in appactivity and initialize it there. Im asuming u not improting Java classes in javaā€¦

U adding fabric in build gradle which belongs to appactivity, that why it cant find it in cocos2dx class

Yes, now itā€™s working. Thanks a lot for your great support.

Were you able to sort it out? Iā€™m also struggling with this same issue. But mine was already existing before crashlytics integration. @energyy Sir, do you have any solution for it too ?

Yes, I solved it out. actually currently we use ā€˜armeabiā€™ ABI structure in our build.gradle file. So if we just make build for ā€˜armeabi-v7ā€™ instead of ā€˜armeabiā€™. then this build will show crashlog for all API level also we have make change in ā€˜Application.mkā€™ for ā€˜armeabiā€™. If you need furthe help for it, then tell me.

So you mean you just build for armeabi ? Mine is already armeabi. When I runscene from scene A to scene B and return back to scene A again then the game freezes with this log google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ### .

No, By default it is armeabi, I built for armeabi-v7.

You can go through the below steps

Integrating Fabric Crashlytics to Android Platform

  1. Open the link below which will guide you how to install fabric plugin in android studio.
    https://fabric.io/downloads/android
    Open your game android project.
    Click android Studio->preference.
    In preference select Plugins.
    Select browse repositories -> search type Fabric.
    You will get an option to install Fabric plugin click install.
    After installing restart your android studio You can see an fabric icon on the top most tab near to help icon Click it, It will open fabric Tool.

  2. Login in Your fabric app Tool and click next.

  3. Click on crashlytics Install Button.

  4. Once you click install, You will get a set of code which you need to copy it to the shown location in our project files.

  5. After copying all codes to the shown location just build and run.

Link for the tutorial of how to install and run fabric with crashlytics.

The above steps will work only for crashes occurring in Java files.
If we need to check the cpp file crashes occurred in Android Studio we need to be added some extra lines of code.

Below link specifies what changes need to be done.
https://fabric.io/downloads/gradle/ndk

Also some changes are
In gradle,properties add android.useDeprecatedNdk=true;
In build.gradle(module:project name) add

ndk {
abiFilters ā€œarmeabiā€, ā€œarmeabi-v7aā€, ā€œx86ā€, ā€œmipsā€
}

Inside

defaultConfig {
}

 3.In build.gradle(module:project name)  add crashlytics {
						 enableNdk true
						androidNdkOut 'obj'
						 androidNdkLibsOut 'libs'

}

  4.In Application.mk file replace APP_ABI := armeabi with APP_ABI := armeabi-v7a

I hope this helps.

3.In build.gradle(module:project name) add crashlytics {
enableNdk true
androidNdkOut ā€˜objā€™
androidNdkLibsOut ā€˜libsā€™

This step is not valid anymore with cocos2d-x 3.15 :slight_smile: its now have different path:

crashlytics {
enableNdk true
androidNdkOut ā€˜build/intermediates/ndkBuild/release/obj/localā€™
androidNdkLibsOut ā€˜build/intermediates/ndkBuild/release/obj/localā€™
}

1 Like

Does anyone know if NDK reports are now working with APIs higher than level 19?
Right now Iā€™m testing on a newer device and crashes (triggered by an exception) in c++ are getting reported as ā€œ???ā€ or in some random *.so.
If I trigger a crash from a java file (like AppActivity) the stacktrace is fine.

Iā€™m currently trying to get an older device to try it out.