Hello I am currently migrating the android part of my cordova/phonegap app from ant to gradle, and I am trying to add the fabric SDK.
In cordova projects the build.gradle seems to be autogenerated, and all changes should be added to the build-extras.gradle. How can I add additional dependencies in the buildscript block?
This is how the stuff for fabric should look in build.gradle, and it works if I put it here, but it is overwritten.
buildscript {
repositories {
mavenCentral()
// this line needs to be added
maven { url 'https://maven.fabric.io/public' }
}
// this block needs to be added
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
If I add this block in the build-extras.gradle, Groovy complains with
Failed to apply plugin [id 'io.fabric'] Plugin with id 'io.fabric' not found.
but if I add it into the build.gradle it might get overridden and will not be added to my colleagues builds (there is a warning at the top of the file that it should not be edited).
My build-extras.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
android {
dependencies {
compile('com.facebook.android:facebook-android-sdk:3.21.1') {
exclude module: 'support-v4'
}
compile 'com.google.android.gms:play-services:7.5.0'
}
// dexOptions {
// preDexLibraries = false
// }
}
apply plugin: 'io.fabric'
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// Crashlytics Kit
compile('com.crashlytics.sdk.android:crashlytics:2.3.2@aar') {
transitive = true
}
}
I am pretty new to Gradle ... in the build.gradle there is this line ... maybe it can help me?
// Allow plugins to declare Maven dependencies via build-extras.gradle.
repositories {
mavenCentral()
}