Newest Fabric documentation says
If using the Android plugin for Gradle version 2.2.0+ with the externalNativeBuild DSL, you should remove the androidNdkOut and androidNdkLibsOut properties, as these paths will automatically be detected by the Fabric plugin. But it's not working for me because my native code located in library module I guess. I have native code in library module and enabled Crashlytics in app module. How can I make it work?
I am using com.android.tools.build:gradle:2.3.3 and io.fabric.tools:gradle:1.23.0.
Error:
com.crashlytics.tools.android.project.codemapping.CodeMappingException: Crashlytics could not find NDK output directory '[my app module path]/obj'. Is the -androidNdkOut setting configured correctly?
UPDATE. I moved Crashlytics configuration to my library module:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath('com.android.tools.build:gradle:2.3.3') {
force = true
}
classpath 'io.fabric.tools:gradle:1.23.0'
}
}
repositories {
jcenter()
}
apply plugin: 'com.android.library'
apply plugin: 'io.fabric'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
publishNonDefault true
defaultConfig {
minSdkVersion 16
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
ndk {
moduleName "core"
}
externalNativeBuild {
ndkBuild {
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64", "mips", "mips64"
}
}
}
lintOptions {
abortOnError false
}
buildTypes {
debug {
debuggable true
jniDebuggable true
minifyEnabled false
}
release {
debuggable false
jniDebuggable false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
externalNativeBuild {
ndkBuild {
path 'jni/Android.mk'
}
}
}
crashlytics {
enableNdk true
baseManifestPath '../app/src/main/AndroidManifest.xml'
}
dependencies {
compile "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
compile "com.android.support:design:${rootProject.ext.supportLibVersion}"
compile "com.google.android.gms:play-services-maps:${rootProject.ext.playServicesVersion}"
compile "com.google.android.gms:play-services-location:${rootProject.ext.playServicesVersion}"
}
My app module now contains only dependencies:
dependencies {
// Crashlytics Kit
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true
}
// NDK Kit
compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.6@aar') {
transitive = true
}
}
But now I getting error
Could not find method baseManifestPath() for arguments [path to my Manifest] on object of type com.crashlytics.tools.gradle.CrashlyticsExtension.