I am not able to configure Crashlytics in my application.
Just when I apply the fabric plugin (plugin: 'io.fabric'
) and build, I get this error.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> groovy.lang.MissingPropertyException: No such property: betaDistributionApkFilePath for class: org.codehaus.groovy.runtime.GStringImpl
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
CONFIGURE FAILED in 4s
No such property: betaDistributionApkFilePath for class: org.codehaus.groovy.runtime.GStringImpl
My gradle files are :
build.gradle (project level)
buildscript {
ext.kotlin_version = '1.3.41'
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.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 {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (app level)
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply from: '../dependencies.gradle'
android {
compileSdkVersion compileVersion
buildToolsVersion = buildTools
defaultConfig {
applicationId appId
minSdkVersion minVersion
targetSdkVersion targetVersion
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
}
signingConfigs {
release {
storeFile file(keyStoreFile)
keyPassword releaseKeyPassword
keyAlias releaseKeyAlias
storePassword releaseStorePassword
}
debug {
storeFile file('../extra/debug.jks')
keyPassword 'android'
storePassword 'android'
keyAlias 'android'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
multiDexEnabled true
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
resValue "string", "app_name", "@string/app_name_release"
buildConfigField "String", "BASE_URL", '"https://www.mywebsite.com/api/"'
}
debug {
minifyEnabled false
debuggable true
shrinkResources false
multiDexEnabled true
signingConfig signingConfigs.debug
applicationIdSuffix '.debug'
resValue "string", "app_name", "@string/app_name_debug"
buildConfigField "String", "BASE_URL", '"https://staging.mywebsite.com/api/"'
}
}
androidExtensions {
experimental = true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation testDependencies.values()
testImplementation androidTestDependencies.values()
implementation kotlinDependencies.values()
implementation androidSupportLibraries.values()
implementation daggerDependencies.values()
implementation androidArchDependencies.values()
implementation rxJavaDependencies.values()
implementation retrofitDependencies.values()
implementation firebaseDependencies.values()
implementation cookieJar
implementation timber
implementation crashlytics
implementation glide
api glideDependencies.values()
kapt glideCompiler
kapt daggerAnnotationProcessor.values()
kapt roomAnnotationProcessor
}
apply plugin: 'com.google.gms.google-services'
dependencies.gradle (all dependencies declared over here)
ext {
compileVersion = 28
minVersion = 16
targetVersion = 28
buildTools = '28.0.3'
appId = 'com.mywebsite.demo'
def kotlinVersion = '1.3.41'
def kotlinCoreVersion = '1.0.2'
def daggerVersion = '2.17'
def retrofitVersion = '2.4.0'
def loggingInterceptorVersion = '3.10.0'
def rxAndroidVersion = '2.1.1'
def rxJavaVersion = '2.2.9'
def testRunnerVersion = '1.1.1'
def appCompatVersion = '1.0.2'
def espressoCoreVersion = '3.1.1'
def constraintLayoutVersion = '1.1.3'
def lifecycleExtensionsVersion = '1.1.1'
def cookieJarVersion = "v1.0.1"
def roomVersion = "2.1.0-rc01"
def roomRxVersion = "1.1.1"
def roomAnnotationProcessorVersion = "2.0.0-rc01"
def timberVersion = "4.6.1"
def recyclerViewVersion = "1.0.0"
def designSupportLibVersion = "1.1.0-alpha06"
def glideVersion = "4.9.0"
def glideTransformationVersion = "3.0.1"
def firebaseAnalyticsVersion = "17.0.1"
def firebaseConfigVersion = "18.0.0"
def fcmVersion = "19.0.1"
def crashlyticsVersion = "2.10.1"
testDependencies = [
"junit": "junit:junit:4.13-beta-3"
]
androidTestDependencies = [
"runner" : "androidx.test:runner:$testRunnerVersion",
"espressoCore": "androidx.test.espresso:espresso-core:$espressoCoreVersion"
]
kotlinDependencies = [
"kotlinStdLib": "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion",
"kotlinCore" : "androidx.core:core-ktx:$kotlinCoreVersion"
]
androidSupportLibraries = [
"appcompat" : "androidx.appcompat:appcompat:$appCompatVersion",
"constraintlayout": "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion",
"recyclerview" : "androidx.recyclerview:recyclerview:$recyclerViewVersion",
"design" : "com.google.android.material:material:$designSupportLibVersion",
]
retrofitDependencies = [
"retrofit" : "com.squareup.retrofit2:retrofit:$retrofitVersion",
"gson" : "com.squareup.retrofit2:converter-gson:$retrofitVersion",
"adapter-rxjava2" : "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion",
"logging-interceptor": "com.squareup.okhttp3:logging-interceptor:$loggingInterceptorVersion"
]
rxJavaDependencies = [
"rxandroid": "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion",
"rxjava" : "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
]
androidArchDependencies = [
"lifecycleExtensions": "android.arch.lifecycle:extensions:$lifecycleExtensionsVersion",
"room" : "androidx.room:room-runtime:$roomVersion",
"roomRx" : "android.arch.persistence.room:rxjava2:$roomRxVersion"
]
daggerAnnotationProcessor = [
"daggerCompiler": "com.google.dagger:dagger-compiler:$daggerVersion",
"daggerAP" : "com.google.dagger:dagger-android-processor:$daggerVersion"
]
daggerDependencies = [
"dagger" : "com.google.dagger:dagger:$daggerVersion",
"dagger-android" : "com.google.dagger:dagger-android:$daggerVersion",
"dagger-android-support": "com.google.dagger:dagger-android-support:$daggerVersion"
]
glideDependencies = [
"glideIntegration" : "com.github.bumptech.glide:okhttp3-integration:$glideVersion",
"glideAnnotationProcesser": "com.github.bumptech.glide:annotations:$glideVersion",
"glideTransformation" : "jp.wasabeef:glide-transformations:${glideTransformationVersion}",
]
firebaseDependencies = [
"firebaseAnalytics": "com.google.firebase:firebase-core:$firebaseAnalyticsVersion",
"firebaseConfig" : "com.google.firebase:firebase-config:$firebaseConfigVersion",
"fcm" : "com.google.firebase:firebase-messaging:${fcmVersion}"
]
cookieJar = "com.github.franmontiel:PersistentCookieJar:$cookieJarVersion"
roomAnnotationProcessor = "androidx.room:room-compiler:$roomAnnotationProcessorVersion"
timber = "com.jakewharton.timber:timber:${timberVersion}"
glide = "com.github.bumptech.glide:glide:${glideVersion}"
glideCompiler = "com.github.bumptech.glide:compiler:${glideVersion}"
crashlytics = "com.crashlytics.sdk.android:crashlytics:${crashlyticsVersion}"
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mywebsite.demo">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:name=".App"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="com.mywebsite.demo.app.activity.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<service
android:name=".managers.fcm.FcmMessageService"
android:stopWithTask="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<meta-data
android:name="io.fabric.ApiKey"
android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
</application>
</manifest>
The issue got resolved by doing a lot of hit and trial on how Crashlytics
needs to be declared in separate Gradle file.
Changes made were : dependencies.gradle
Before
ext {
def crashlyticsVersion = "2.10.1"
crashlytics = "com.crashlytics.sdk.android:crashlytics:${crashlyticsVersion}"
}
After
ext {
def crashlyticsVersion = "2.10.1"
crashlyticsDependencies = [
"crashlytics": "com.crashlytics.sdk.android:crashlytics:${crashlyticsVersion}"
]
}
build.gradle (app level)
Before
dependencies {
implementation crashlytics
}
After
dependencies {
implementation crashlyticsDependencies.values()
}
Still not sure why crashlytics forces only this type of declaration.