question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AAPT: error: resource android:attr/fontVariationSettings not found.

See original GitHub issue

_~.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 ?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:10
  • Comments:18

github_iconTop GitHub Comments

17reactions
shreyakupadhyaycommented, Jul 2, 2019

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.

12reactions
jitheshktcommented, Jul 3, 2019

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

error: resource android:attr/fontVariationSettings not found
try to change the compileSdkVersion to: compileSdkVersion 28. fontVariationSettings added in api level 28. Api doc here.
Read more >
error: resource android:attr/fontVariationSettings not found
Hey, just tried to run a build today and ran into this issue. I initially didn't do any updates or anything, just tried...
Read more >
resource android:attr/fontVariationSettings not found
Hello,. So this appears to be a rather persistent problem while building with phonegap. I'm using the latest config.xml in this moodle ...
Read more >
error: resource android:attr/fontvariationsettings not found. flutter
error : resource android:attr/fontvariationsettings not found. flutter. For those that must keep compileSdkVersion 27 and are unable to upgrade to androidx ...
Read more >
Solved : AAPT: error: resource android:attr/lStar not found
AAPT : error : resource android : attr /lStar not foundAAPT: error : resource android : attr /lStar not found #انتسب_للقناة_من_هنا ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found