1

In my project I use Firebase analytics. After I updated in gradle its version from

implementation 'com.google.firebase:firebase-core:16.0.7'

to

implementation 'com.google.firebase:firebase-core:17.0.0'

I got compile error

Android resource linking failed
/Users/josefvancura/Desktop/Programing/Android/PepaApps/Dochazka/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:2663: error: resource android:attr/fontVariationSettings not found.
/Users/josefvancura/Desktop/Programing/Android/PepaApps/Dochazka/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:2663: error: resource android:attr/ttcIndex not found.
error: failed linking references.

my build.gradle

buildscript {
  repositories {
      maven { url 'https://maven.fabric.io/public' }
  }

  dependencies {
      classpath 'io.fabric.tools:gradle:1.27.0'
  }
}

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

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


android {
   compileSdkVersion 27    // Android 8.1.

defaultConfig {
    applicationId "cz.vancura.dochazka"
    minSdkVersion 21        // Android 5.0
    targetSdkVersion 27     // android 8.1
    versionCode 11          // vzdy plus 1
    versionName "5.5"
}

signingConfigs {
    buildTypes {
        debug {
            buildConfigField "java.util.Date", "buildTime", "new java.util.Date(" + System.currentTimeMillis() + "L)"
        }
        release {
            buildConfigField "java.util.Date", "buildTime", "new java.util.Date(" + System.currentTimeMillis() + "L)"
        }
    }
}

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

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

  implementation 'com.android.support:appcompat-v7:27.1.1'
  implementation 'com.android.support:preference-v7:27.1.1'
  implementation 'com.android.support:design:27.1.1'
  implementation 'com.android.support.constraint:constraint-layout:1.1.3'
  implementation 'com.android.support:cardview-v7:27.1.1'

  // update to version 17 - compile error, keep 16.0.7
  implementation 'com.google.firebase:firebase-core:16.0.7'

  implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
  implementation('com.crashlytics.sdk.android:crashlytics-ndk:2.0.3@aar') {
    transitive = true
}

  implementation 'com.github.hotchemi:android-rate:1.0.1'
  implementation 'com.opencsv:opencsv:4.0'

  testImplementation 'junit:junit:4.12'
  androidTestImplementation 'com.android.support.test:runner:1.0.2'
  androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

}

apply plugin: 'com.google.gms.google-services'

crashlytics {
  enableNdk true
  androidNdkOut 'src/main/obj'
  androidNdkLibsOut 'src/main/libs'
}
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
Josef Vancura
  • 1,053
  • 10
  • 18

2 Answers2

1

You can check the official release notes:

Warning: This release is a MAJOR version update and breaking change. The latest update to Google Play services and Firebase includes the following changes:

Migration from Android Support Libraries to Jetpack (AndroidX) Libraries. Libraries will not work unless you make the following changes in your app:

  • Upgrade com.android.tools.build:gradle to v3.2.1 or later.
  • Upgrade compileSdkVersion to 28 or later.
  • Update your app to use Jetpack (AndroidX); follow the instructions in Migrating to AndroidX.

You have to change the compileSdkVersion to 28 and to migrate to androidx library.

compileSdkVersion 28

Also you can check the fontVariationSettings attribute. It was added in api level 28.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
0

Try to change the compileSdkVersion to: compileSdkVersion 28

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
Chris Papantonis
  • 720
  • 7
  • 18
  • this will return another error ERROR: Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:15:5-66:15 to override. – Josef Vancura Jun 24 '19 at 12:33
  • 1
    @JosefVancura This error is related to androidx migration required by the new firebase libraries. Check the release notes described in the answer below and the steps to follow to fix it. – Gabriele Mariotti Jun 24 '19 at 12:36