react-native: AAPT: error: resource android:attr/fontVariationSettings not found.

_~.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\b455673db66bf379c6b553212db86e77\res\values\values.xml:251:5-69: AAPT: error: resource android:attr/fontVariationSettings not found.

~.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\b455673db66bf379c6b553212db86e77\res\values\values.xml:251:5-69: AAPT: error: resource android:attr/ttcIndex not found._

I am facing this issue.

app/build.gradle

android {
    compileSdkVersion 28
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "com.Marian"
        minSdkVersion 16
        targetSdkVersion 27
        versionCode 0016
        versionName "marianv0016"
        multiDexEnabled true


        lintOptions {
            abortOnError false
        }


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



dependencies {
   implementation project(':react-native-gesture-handler')
   implementation project(':react-native-push-notification')
   implementation fileTree(dir: "libs", include: ["*.jar"])
   implementation "com.android.support:appcompat-v7:27.1.1"
   implementation "com.android.support:support-core-utils:27.1.1"
   implementation project(':react-native-fcm')
   implementation 'com.google.firebase:firebase-core:16.0.9'
   implementation 'com.google.firebase:firebase-messaging:18.0.0'
   implementation ("com.facebook.react:react-native:+") { force = true }  // From node_modules
   implementation project(':realm')
   implementation project(':react-native-fs')
   implementation project(':react-native-vector-icons')
   implementation project(':react-native-image-picker')
   implementation project(':rn-fetch-blob')
   implementation project(':react-native-image-crop-picker')
   implementation project(':react-native-exit-app')
   implementation project(':react-native-onesignal')
   implementation project(':react-native-sensor-manager')
   implementation project(':react-native-smart-barcode')
   implementation project(':react-native-push-notification')
   implementation project(':react-native-linear-gradient')
   implementation project(':react-native-file-picker')
   implementation project(':react-native-doc-viewer')
   implementation project(':react-native-svg')
   implementation project(":react-native-google-signin")
   implementation project(':react-native-spinkit')
   implementation project(':react-native-pdf')
}

// apply plugin: 'com.google.gms.google-services'
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}


configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '27.1.1'
            }
        }
    }
}

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

build.gradle

buildscript {
     ext {
        googlePlayServicesAuthVersion = "12.0.1" // <--- use this version or newer
      //  firebaseVersion ="17.3.4"
    }
    repositories {
     google()
        jcenter()
    }
    dependencies {
    
        classpath 'com.google.gms:google-services:3.2.1'
        classpath 'com.android.tools.build:gradle:3.1.0'


    }
}

allprojects {
    repositories {
        google()
        mavenLocal()
        mavenLocal()
        // for modules depending on jitpack.io
        maven { url "https://jitpack.io" }
        // add this one
        maven {
            url "https://maven.google.com"
        }
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
             url "$rootDir/../node_modules/react-native/android"
          //   url 'https://maven.google.com'
        }
        jcenter()
    }
}

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 27
                defaultConfig {
                    targetSdkVersion 27
                }
            }
        }
    }
}




subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "27.1.1"
            }
        }
    }
}


distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

Why does it happens. Any idea hot to solve this ?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 10
  • Comments: 18

Commits related to this issue

Most upvoted comments

Until a fix for this comes, use the below procedure to fix the issue.

This happened because Google upgraded libraries for androidX and few react native projects also started supporting it. React Native version 0.60.0 will get support for these libraries, maybe not below that. So you have to use the lower versions for those android libraries. To solve, follow the procedure below.

  1. Check what all react native projects are supporting androidX now.
$ gradlew app:dependencies

Search for androidX in the output. Get all the libraries having androidx. 2. Make a change in build.gradle inside android/app

configurations.all {
    resolutionStrategy { 
        force 'com.google.android.gms:play-services-gcm:16.1.0'
        force 'com.google.android.gms:play-services-basement:16.2.0'
        force 'com.google.android.gms:play-services-auth:16.0.1'
        force 'com.google.firebase:firebase-messaging:18.0.0'
        force 'com.google.firebase:firebase-common:17.0.0'        
        force 'com.google.firebase:firebase-iid:18.0.0'
        force 'com.google.android.gms:play-services-stats:16.0.1'
        force 'com.google.android.gms:play-services-base:16.0.1'
    }
}

These were the libraries that caused problem in my react native project. Google maintains all the releases here https://developers.google.com/android/guides/releases#may_07_2019 . You can choose any other version also. This solution solved issue in my case. Let me know if this helps.

IF your project is on SDK version 27 simply add googlePlayServicesVersion=12.0.1 on top of the android/gradle.properties file.

@shreyakupadhyay Thanks, this solution solve my problem. I can compile my app but I couldn’t generate apk =( So, I put this code in android/build.gradle:

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 28
                buildToolsVersion '28.0.3'
            }
            configurations.all {
                resolutionStrategy { 
                    force 'com.google.android.gms:play-services-gcm:16.1.0'
                    force 'com.google.android.gms:play-services-location:16.0.1'
                    force 'com.google.android.gms:play-services-basement:16.2.0'
                    force 'com.google.android.gms:play-services-auth:16.0.1'
                    force 'com.google.android.gms:play-services-stats:16.0.1'
                    force 'com.google.android.gms:play-services-base:16.0.1'
                }
            }
        }
    }
}

Everything works now!

@shreyakupadhyay Thanks, your solution really works! I tried to resolve this issue for days, including upgrade sdkVersion to 28, and migrate to AndroidX in Android Studio. It can compile successfully but the result apk miss index.bundle.js 。

Thanks for submitting your issue. Can you take another look at your description and make sure the issue template has been filled in its entirety?

👉 Click here if you want to take another look at the Bug Report issue template.

Until a fix for this comes, use the below procedure to fix the issue.

This happened because Google upgraded libraries for androidX and few react native projects also started supporting it. React Native version 0.60.0 will get support for these libraries, maybe not below that. So you have to use the lower versions for those android libraries. To solve, follow the procedure below.

  1. Check what all react native projects are supporting androidX now.
$ gradlew app:dependencies

Search for androidX in the output. Get all the libraries having androidx. 2. Make a change in build.gradle inside android/app

configurations.all {
    resolutionStrategy { 
        force 'com.google.android.gms:play-services-gcm:16.1.0'
        force 'com.google.android.gms:play-services-basement:16.2.0'
        force 'com.google.android.gms:play-services-auth:16.0.1'
        force 'com.google.firebase:firebase-messaging:18.0.0'
        force 'com.google.firebase:firebase-common:17.0.0'        
        force 'com.google.firebase:firebase-iid:18.0.0'
        force 'com.google.android.gms:play-services-stats:16.0.1'
        force 'com.google.android.gms:play-services-base:16.0.1'
    }
}

These were the libraries that caused problem in my react native project. Google maintains all the releases here https://developers.google.com/android/guides/releases#may_07_2019 . You can choose any other version also. This solution solved issue in my case. Let me know if this helps.

I would like to thankyou for this. days of trying different things

In my case I changed this implementation project(':react-native-push-notification') to compile project(':react-native-push-notification') and disabled the androidx implementation completely.

and then I followed this thread : https://github.com/zo0r/react-native-push-notification/pull/1092

I am getting this issue as well when I run react-native run-android.

Environment:
  OS: macOS High Sierra 10.13.6
  Node: 11.10.1
  Yarn: 1.10.1
  npm: 6.7.0
  Watchman: 4.7.0
  Xcode: Xcode 10.1 Build version 10B61
  Android Studio: 3.4 AI-183.5429.30.34.5452501

Packages: (wanted => installed)
  react: 16.8.3 => 16.2.0
  react-native: 0.59.9 => 0.53.3

You can download a copy of the reproducible app here: https://www.dropbox.com/s/ygyrhnno8aou4jg/RNsampleApp.zip?dl=0