Crashlytics cocos2dx 3.7 + Android Studio

@pandemosth Hi, I’m now decided also to try Crashlytics + Android Studio + Cocos2d-x 3.8

Can you give your steps which files you modified. For me doesn’t work, modified build.gradle for project:

sourceSets.main {
    java.srcDirs = ["src"]
    res.srcDirs = ["res"]
    jniLibs.srcDir "libs"
    manifest.srcFile "AndroidManifest.xml"
    assets.srcDirs = ["assets"]
}

My build.gradle looks like this:

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

buildscript {
    repositories {
        jcenter() {
            maven { url 'https://maven.fabric.io/public' }
        }
    }
    dependencies {

        classpath 'io.fabric.tools:gradle:1.+'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

repositories {
    jcenter()
    maven { url 'https://maven.fabric.io/public' }
}

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "con.myapp.testndk"
        minSdkVersion 10
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }

    sourceSets.main {
        java.srcDir "src"
        res.srcDir "res"
        jniLibs.srcDir "libs"
        manifest.srcFile "AndroidManifest.xml"
        assets.srcDir "assets"
    }

    signingConfigs {

       release {
            if (project.hasProperty("RELEASE_STORE_FILE")) {
                storeFile file(RELEASE_STORE_FILE)
                storePassword RELEASE_STORE_PASSWORD
                keyAlias RELEASE_KEY_ALIAS
                keyPassword RELEASE_KEY_PASSWORD
            }
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            if (project.hasProperty("RELEASE_STORE_FILE")) {
                signingConfig signingConfigs.release
            }
        }
    }
}


crashlytics {
    enableNdk true
    androidNdkOut 'obj'
    androidNdkLibsOut 'libs'
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':libcocos2dx')
    compile 'com.google.android.gms:play-services:7.3.0'
    // Crashlytics Kit
    compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') {
        transitive = true
    }
    // NDK Kit
    compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.1@aar') {
        transitive = true
    }

}

OMG!!! :smiley:
I made it work )) Decompiled APK and understood where was problem!!!

Regarding missing libcocos2dx.so library, it is because when you include Crashlytics it downloading all possible architectures, but cocos by default compiling only ARMEABI, so when you launch app on device if it is not armeabi, it looks in crashlytic generated folder like ARMEABI-V7 and there is no libcocos2dx.so that why it crashing.

Solution to make Crashlytic compile only for specific platform

android {
  
    splits {
        abi {
            enable true
            reset()
            include 'armeabi'
            universalApk false
        }
    }
}

I added quite a while back and did not have any trouble. At that point they had no support NDK games, so it would never catch crashes in C++ code. They should have fixed that by now I hope.

this comment is not relevant to current situation :slight_smile:

I want to use cocos2d-x-3.7 in android studio.
And I found some informations like “cocos2d-x-3.7/tools/cocos2d-console/bin/cocos compile -p android --android-studio”,and import the proj.android-studio to android studio. The proj.android-studio is contained in the cocos2d-x-3.7.

But I got some problems. Show below, and anyone can help me to resolve these problems.

F:\javac\cocos2d-x-3.7\cocos2d-x-3.7>setup.py

Setting up cocos2d-x…
->Check environment variable COCOS_CONSOLE_ROOT
->Search for environment variable COCOS_CONSOLE_ROOT…
->COCOS_CONSOLE_ROOT is found : F:\javac\cocos2d-x-3\cocos2d-x-3\tools\cocos
2d-console\bin

->Remove directory "F:\javac\cocos2d-x-3\cocos2d-x-3\tools\cocos2d-console\bin
" from PATH!

->Add directory “F:\javac\cocos2d-x-3.7\cocos2d-x-3.7\tools\cocos2d-console\bi
n” into PATH succeed!

->Force update environment variable COCOS_CONSOLE_ROOT
->Succeed : COCOS_CONSOLE_ROOT=F:\javac\cocos2d-x-3.7\cocos2d-x-3.7\tools\co
cos2d-console\bin
->Check environment variable COCOS_TEMPLATES_ROOT
->Search for environment variable COCOS_TEMPLATES_ROOT…
->COCOS_TEMPLATES_ROOT is found : F:\javac\cocos2d-x-3\cocos2d-x-3\templates

->Remove directory “F:\javac\cocos2d-x-3\cocos2d-x-3\templates” from PATH!

->Add directory “F:\javac\cocos2d-x-3.7\cocos2d-x-3.7\templates” into PATH suc
ceed!

->Force update environment variable COCOS_TEMPLATES_ROOT
->Succeed : COCOS_TEMPLATES_ROOT=F:\javac\cocos2d-x-3.7\cocos2d-x-3.7\templa
tes
->Configuration for Android platform only, you can also skip and manually edit y
our environment variables

->Check environment variable NDK_ROOT
->Search for environment variable NDK_ROOT…
->NDK_ROOT is found : F:\javac\android-ndk-r10e

->Check environment variable ANDROID_SDK_ROOT
->Search for environment variable ANDROID_SDK_ROOT…
->ANDROID_SDK_ROOT is found : F:\javac\adt-bundle-windows\sdk

->Check environment variable ANT_ROOT
->Search for environment variable ANT_ROOT…
->ANT_ROOT is found : F:\javac\adt-bundle-windows\apache-ant-1.9.6-bin\apach
e-ant-1.9.6\bin

Please restart the terminal or restart computer to make added system variables t
ake effect

F:\javac\cocos2d-x-3.7\cocos2d-x-3.7\tests\js-tests>cd project

F:\javac\cocos2d-x-3.7\cocos2d-x-3.7\tests\js-tests\project>cd proj.android-stud
io

F:\javac\cocos2d-x-3.7\cocos2d-x-3.7\tests\js-tests\project\proj.android-studio>
dir
驱动器 F 中的卷没有标签。
卷的序列号是 8456-20BC

F:\javac\cocos2d-x-3.7\cocos2d-x-3.7\tests\js-tests\project\proj.android-studio
的目录

2015/09/29 20:42 .
2015/09/29 20:42 …
2015/05/27 17:02 91 .gitignore
2015/09/29 19:53 app
2015/06/16 23:53 769 build-cfg.json
2015/05/27 17:02 436 build.gradle
2015/07/21 10:24 gradle
2015/05/27 17:02 855 gradle.properties
2015/06/02 10:08 5,080 gradlew
2015/05/27 17:02 2,314 gradlew.bat
2015/09/29 20:42 428 local.properties
2015/06/02 10:08 213 settings.gradle
8 个文件 10,186 字节
4 个目录 57,317,797,888 可用字节

F:\javac\cocos2d-x-3.7\cocos2d-x-3.7\tests\js-tests\project\proj.android-studio>
F:\javac\cocos2d-x-3.7\cocos2d-x-3.7\tools\cocos2d-console\bin\cocos compile -p
android --android-studio
执行命令:compile
编译模式:debug
使用 Android Studio 工程:F:\javac\cocos2d-x-3.7\cocos2d-x-3.7\tests\js-tests\pr
oject/proj.android-studio
未指定 Android 目标平台版本,自动查找一个可用版本…
正在执行:’“F:\javac\adt-bundle-windows\sdk\tools\android” update project -t and
roid-10 -p F:\javac\cocos2d-x-3.7\cocos2d-x-3.7\tests\js-tests\project/proj.andr
oid-studio\app’

‘xcopy’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。
系统找不到指定的路径。
系统找不到指定的路径。
系统找不到指定的路径。
系统找不到指定的路径。
系统找不到指定的路径。
系统找不到指定的路径。
系统找不到指定的路径。
系统找不到指定的路径。
系统找不到指定的路径。
系统找不到指定的路径。
系统找不到指定的路径。
系统找不到指定的路径。
系统找不到指定的路径。
系统找不到指定的路径。
系统找不到指定的路径。
系统找不到指定的路径。
系统找不到指定的路径。
系统找不到指定的路径。
系统找不到指定的路径。
系统找不到指定的路径。
系统找不到指定的路径。
系统找不到指定的路径。
Updated project.properties
Updated local.properties
Updated file F:\javac\cocos2d-x-3.7\cocos2d-x-3.7\tests\js-tests\project\proj.an
droid-studio\app\proguard-project.txt
正在执行 ndk-build…
NDK 编译模式:debug
从 F:\javac\android-ndk-r10e\RELEASE.TXT 文件获取 NDK 版本失败。
NDK_TOOLCHAIN_VERSION: 4.8
正在执行:’“F:\javac\android-ndk-r10e\ndk-build” -C F:\javac\cocos2d-x-3.7\cocos
2d-x-3.7\tests\js-tests\project/proj.android-studio\app -j4 NDK_MODULE_PATH=F:\j
avac\cocos2d-x-3.7\cocos2d-x-3.7\tests\js-tests\project/proj.android-studio…/.
./…/…;F:\javac\cocos2d-x-3.7\cocos2d-x-3.7\tests\js-tests\project/proj.android
-studio…/…/…/…/cocos;F:\javac\cocos2d-x-3.7\cocos2d-x-3.7\tests\js-tests\pr
oject/proj.android-studio…/…/…/…/external NDK_TOOLCHAIN_VERSION=4.8 NDK_DEB
UG=1’

系统找不到指定的路径。
执行命令出错,返回值:1。
F:\javac\cocos2d-x-3.7\cocos2d-x-3.7\tests\js-tests\project\proj.android-studio>

You should configure cocos2d-x run setup.py

Just for a future reference.

If you are using Fabric and NDK crash reporting with cocos2d-x and you want to support for example only armeabi-v7a and armeabi in a single APK without Fabric adding all other ABIs add this to your gradle:

 buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

            ndk {
                abiFilters "armeabi-v7a", "armeabi"
            }
        }

        debug {
            signingConfig signingConfigs.debug

            ndk {
                abiFilters "armeabi-v7a", "armeabi"
            }
        }

    }

This is without using ABI splits.

1 Like

Any update on how to fix the “No Android modules detected!” message that the Fabric plugin in Android Studio shows?

I switched to using eclipse for integrating Crashlytics and it works fine for me. Stopped using Android Studio until it became more stable for cocos2d-x projects.

I have created a cocos2dx (version 3.10) project the usual way running from terminal:
“cocos new MyGame7 -p com.company.MyGame7 -l cpp” and compiling it for android studio
“cocos compile -p android --android-studio -ap android-22 -m debug” and I can export MyGame7 and run on it on device as expected.

Now I would like to add crashlytics to be able to get crashlogs for crashes that happens in my cpp game code.
The Fabric install guide tells me to modify the build.gradle. Now in my project I see 3 build gradles and I am not sure which one to modify.

I tried to modify build gradle for my app "build.gradle(Module: MyGame7) because this is the one inside my app folder in my android studio project folder.
It looks like it does what it should and the fabric-plugin is being installed ( io.fabric.sdk.android and com.crashlytics.sdk.android folders are created in this location “/MyGame7/proj.android-studio/app/build/intermediates/exploded-aar”).
Now the manual tells me to modify “StartActivity” and the only startActivity I can find in my cocos2dx project is
MyGame7/cocos2d/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java and when I modify this file, trying to import
Fabric/Crashlytics :

import com.crashlytics.android.Crashlytics
import com.crashlytics.android.ndk.CrashlyticsNdk;
import io.fabric.sdk.android.Fabric;

It will not compile and tells me that these packages does not exist. Is this because I should have started out with modifying the build.gradle
for “Module libcocos2dx”?

I am very confused and would appreciate any help.
Best
Esben

Modify your project gradle.build file in your case it is MyGame7:

There is real working example, just change your package name and add to manifest file key for crashlytics, make initialization of crashlytics in AppActivity.java file:

buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.+'
        // The Fabric Gradle plugin uses an open ended version to
        // react quickly to Android tooling updates
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

apply plugin: 'com.android.application'

apply plugin: 'io.fabric'

repositories {
    jcenter()
    maven { url 'https://maven.fabric.io/public' }
}



android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.tourpackagename.gameblabla"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.00"
    }

    sourceSets.main {
        java.srcDir "src"
        res.srcDir "res"
        jniLibs.srcDir "libs"
        manifest.srcFile "AndroidManifest.xml"
        assets.srcDir "assets"
    }

    splits {
        abi {
            enable true
            reset()
            include 'armeabi'
            universalApk false
        }
    }

    signingConfigs {

       release {
            if (project.hasProperty("RELEASE_STORE_FILE")) {
                storeFile file(RELEASE_STORE_FILE)
                storePassword RELEASE_STORE_PASSWORD
                keyAlias RELEASE_KEY_ALIAS
                keyPassword RELEASE_KEY_PASSWORD
            }
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            if (project.hasProperty("RELEASE_STORE_FILE")) {
                signingConfig signingConfigs.release
            }
        }
    }
}


crashlytics {
    enableNdk true
    androidNdkOut 'obj'
    androidNdkLibsOut 'libs'
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':libcocos2dx')

    // Crashlytics Kit
    compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') {
        transitive = true
    }
    // NDK Kit
    compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.1@aar') {
        transitive = true
    }
}

Appactivity code:

 @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        Fabric.with(this, new Crashlytics(), new CrashlyticsNdk());
}

Manifest file:

    <meta-data android:name="io.fabric.ApiKey" android:value="YOUR_SECRET_KEY" />
1 Like

Thank you so much - it works now.

1 Like

After I add crashlytics, gradle build done but when I run project, app crash and show message “Unfornately, libcocos2dx has stopped”, below is logcat output.

W/ResourceType: Found multiple library tables, ignoring…
W/art: Failed to find OatDexFile for DexFile /data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-slice_8-classes.dex ( canonical path /data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-slice_8-classes.dex) with checksum 0x03d8db35 in OatFile /data/data/org.cocos2dx.KVIPJS/cache/slice-slice_8-classes.dex
W/art: Failed to find OatDexFile for DexFile /data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-slice_6-classes.dex ( canonical path /data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-slice_6-classes.dex) with checksum 0xa183843b in OatFile /data/data/org.cocos2dx.KVIPJS/cache/slice-slice_6-classes.dex
W/art: Failed to find OatDexFile for DexFile /data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-slice_4-classes.dex ( canonical path /data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-slice_4-classes.dex) with checksum 0x95c4aadd in OatFile /data/data/org.cocos2dx.KVIPJS/cache/slice-slice_4-classes.dex

FATAL EXCEPTION: main
Process: org.cocos2dx.KVIPJS, PID: 8769
java.lang.UnsatisfiedLinkError: com.android.tools.fd.runtime.IncrementalClassLoader$DelegateClassLoader[DexPathList[[dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-slice_9-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-slice_8-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-slice_7-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-slice_6-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-slice_5-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-slice_4-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-slice_3-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-slice_2-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-slice_1-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-slice_0-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-sdkbox_b07f6d3b730fd2e65e7b0c836b897523b14cf079-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-io.fabric.sdk.android-fabric-1.3.10_d67c41e0c24a1b0e2854c29e3154818e0cd0820f-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-google-play-services_95571133ebf67468e3f693408f68b4b7bec57566-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-com.crashlytics.sdk.android-crashlytics-ndk-1.1.2_242b0468b4c0fbcdd8c438ea8032d00fe03305c6-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-com.crashlytics.sdk.android-crashlytics-core-2.3.8_14b5a559672b400694ee4a5d31b8605e77b5d3d7-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-com.crashlytics.sdk.android-crashlytics-2.5.5_228d8b7e2a00cf609117f8b2e1cd20d9bc96e208-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-com.crashlytics.sdk.android-beta-1.1.4_69c9d55c2872e1a54745575b656721045fdcf97c-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-com.crashlytics.sdk.android-answers-1.3.6_5a6924a1fba7f3f0280cd1f26dca998fbe6e8adf-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-bolts-android-1.1.2_2df307766661fdd60f49c18a8de0515109cd4822-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-android-support-v4_6ca8143db6fe7edce7c610addeef4474326c3dc9-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-android-async-http-1.4.8_44a059b2742f912c7be58d4b6ab0947f690938d6-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-PluginReview_41e45522e21570596f9dd9601f6f876e1bbeb1f1-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-PluginGooglePlay_fa0cd7fc2bf38d24acf9f5d92d6bf7bf3b66d2b9-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-PluginGoogleAnalytics_517f5aff99c3fc1ae650708f27a09f3df7d43efc-classes.dex”, dex file “/data/data/org.cocos2dx.KVIPJS/files/instant-run/dex/slice-PluginFacebook_c27ce0dbc0260db539230a2697ef90ae3533d66d-classes.dex”],nativeLibraryDirectories=[/data/app/org.cocos2dx.KVIPJS-2/lib/arm, /vendor/lib, /system/lib, /vendor/lib, /system/lib]]] couldn’t find “libcocos2djs.so”
at java.lang.Runtime.loadLibrary(Runtime.java:366)
at java.lang.System.loadLibrary(System.java:988)
at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:249)
at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:264)
at org.cocos2dx.javascript.AppActivity.onCreate(AppActivity.java:47)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityT

Share your build.gradle file, seems you modified something wrongly. I think you didn’t added splits

splits {
        abi {
            enable true
            reset()
            include 'armeabi'
            universalApk false
        }
    }

I have two build.gradle. I tried add splits{} to build.glade but build falied, this is output: Gradle sync failed: Gradle DSL method not found: ‘splits()’

File 1.
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
maven { url ‘https://maven.fabric.io/public’ }
}
dependencies {
classpath ‘com.android.tools.build:gradle:2.1.0’
classpath ‘io.fabric.tools:gradle:1.+’

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

}
}

allprojects {
repositories {
jcenter()
maven { url ‘https://maven.fabric.io/public’ }
}
}

File 2.

apply plugin: ‘com.android.application’
apply plugin: ‘io.fabric’

android {
compileSdkVersion 22
buildToolsVersion “22.0.1”

defaultConfig {
applicationId “org.cocos2dx.KVIPJS”
minSdkVersion 10
targetSdkVersion 22
versionCode 1
versionName “1.0”
}

sourceSets.main {
java.srcDir “src”
res.srcDir “res”
jniLibs.srcDir “libs”
manifest.srcFile “AndroidManifest.xml”
assets.srcDir “assets”
}

signingConfigs {

release {
if (project.hasProperty(“RELEASE_STORE_FILE”)) {
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’
if (project.hasProperty(“RELEASE_STORE_FILE”)) {
signingConfig signingConfigs.release
}
}
}
}

crashlytics {
enableNdk true
androidNdkOut ‘src/main/obj’
androidNdkLibsOut ‘src/main/libs’
}

dependencies {
compile fileTree(dir: ‘libs’, include: [’*.jar’])
compile project(’:libcocos2dx’)
compile(‘com.crashlytics.sdk.android:crashlytics:2.5.5@aar’) {
transitive = true;
}
compile(‘com.crashlytics.sdk.android:crashlytics-ndk:1.1.2@aar’) {
transitive = true;
}
}

you have wrong File #2(missing splits) so crashlytics including all compiled CPU libraries and when app starting it trying to load for example crashlytcs with amreabiv7 but you project is compiled with armeabi - so it crashing:

Take build.gradle from my previous post on 12th April and replace in your File #2(replace there bundle id with your, in your file you probably was trying to add splits in wrong place). Should work.

btw you no need to change File #1, only change file which is located under app folder, so revert your changes in File #1.

I tried replace File #2 with your file, gradle build done but when I build = console (cocos run -p android -m release --android-studio), it failed. This is error: WindowsError: [Error 3] The system cannot find the path specified: u’F:\Work\Cocos2D-x\Project\KVIPJS\frameworks\runtime-src\proj.android-studio\…/…/…/src\.’. I wish crashlytics intergrate in sdkbox, manual intergrate with android studio really difficult. My project work fine until integrate crashlytics :frowning:

This is #2 File

buildscript {
repositories {
    jcenter()
    maven { url 'https://maven.fabric.io/public' }
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.0.+'
    // The Fabric Gradle plugin uses an open ended version to
    // react quickly to Android tooling updates
    classpath 'io.fabric.tools:gradle:1.+'
}

}

apply plugin: ‘com.android.application’
apply plugin: ‘io.fabric’

repositories {
jcenter()
maven { url ‘https://maven.fabric.io/public’ }
}

android {
compileSdkVersion 22
buildToolsVersion “22.0.1”

defaultConfig {
    applicationId "org.cocos2dx.KVIPJS"
    minSdkVersion 10
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}

sourceSets.main {
    java.srcDir "src"
    res.srcDir "res"
    jniLibs.srcDir "libs"
    manifest.srcFile "AndroidManifest.xml"
    assets.srcDir "assets"
}

splits {
    abi {
        enable true
        reset()
        include 'armeabi'
        universalApk false
    }
}

signingConfigs {

   release {
        if (project.hasProperty("RELEASE_STORE_FILE")) {
            storeFile file(RELEASE_STORE_FILE)
            storePassword RELEASE_STORE_PASSWORD
            keyAlias RELEASE_KEY_ALIAS
            keyPassword RELEASE_KEY_PASSWORD
        }
    }
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        if (project.hasProperty("RELEASE_STORE_FILE")) {
            signingConfig signingConfigs.release
        }
    }
}

}

crashlytics {
enableNdk true
androidNdkOut ‘obj’
androidNdkLibsOut ‘libs’
}

dependencies {
compile fileTree(dir: ‘libs’, include: [’*.jar’])
compile project(’:libcocos2dx’)
compile(‘com.crashlytics.sdk.android:crashlytics:2.5.5@aar’) {
transitive = true;
}
compile(‘com.crashlytics.sdk.android:crashlytics-ndk:1.1.2@aar’) {
transitive = true;
}
}

Ok, I see u running on windows and with Cocos2d-x JS, my code was for C++ , but I think it should work also.

Have you tried to create new project and then integrating crashlytics?

Not a direct answer but could help: there is a new crittercism sdkbox plugin which offers similar functionalities as crashlytics. You might want to give that a try.

Hi everyone, did you guy solved this problem, i did step by step for manual integration, i can run my game normally, but it seems like nothing happens. No crash, no info, no things to show me crashlytics has been integrated.

If i use plugin but it show “No Android modules detected!” T_T