Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
uendar opened this issue Jun 24, 2019 · 18 comments
Closed

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

uendar opened this issue Jun 24, 2019 · 18 comments
Labels
API: Settings Bug Platform: Android Android applications. Ran Commands One of our bots successfully processed a command. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@uendar
Copy link

uendar commented Jun 24, 2019

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

@react-native-bot
Copy link
Collaborator

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.

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. Resolution: Needs More Information labels Jun 24, 2019
@ldco2016
Copy link

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

@HarshitMadhav
Copy link

Hi refer to this here zo0r/react-native-push-notification#1092 (comment)

@javaDart
Copy link

i'm also facing to this

@HarshitMadhav
Copy link

HarshitMadhav commented Jun 27, 2019

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 : zo0r/react-native-push-notification#1092

@shreyakupadhyay
Copy link

shreyakupadhyay commented Jun 30, 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.

@zoechen799
Copy link

@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 。

@jitheshkt
Copy link

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

@ldco2016
Copy link

ldco2016 commented Jul 4, 2019

@shreyakupadhyay , what about if none of the put from running gradlew app:dependencies result in outputting anything to do with Androidx and yet I still get these errors?

@abartolo
Copy link

abartolo commented Jul 4, 2019

@jitheshkt Thanks, I was able to get the build the release build! But now the app crashes when I open with the following error

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/util/zzx;

@ldco2016
Copy link

ldco2016 commented Jul 4, 2019

I don't know if maybe my error is slightly different, this is the error I get:

> Task :appcenter:processDebugAndroidTestResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':appcenter:processDebugAndroidTestResources'.
> Android resource linking failed
  Output:  /Users/danale/Desktop/rn_crashing/node_modules/appcenter/android/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values-v28/values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
  /Users/danale/Desktop/rn_crashing/node_modules/appcenter/android/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values-v28/values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
  /Users/danale/Desktop/rn_crashing/node_modules/appcenter/android/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:957: error: resource android:attr/fontVariationSettings not found.
  /Users/danale/Desktop/rn_crashing/node_modules/appcenter/android/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml:958: error: resource android:attr/ttcIndex not found.
  error: failed linking references.

  Command: /Users/danale/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/15207d7e670ac3341cb9289da8288121/aapt2-3.2.1-4818971-osx/aapt2 link -I\
          /Users/danale/Library/Android/sdk/platforms/android-27/android.jar\
          --manifest\
          /Users/danale/Desktop/rn_crashing/node_modules/appcenter/android/build/intermediates/merged_manifests/debugAndroidTest/processDebugAndroidTestManifest/merged/AndroidManifest.xml\
          -o\
          /Users/danale/Desktop/rn_crashing/node_modules/appcenter/android/build/intermediates/processed_res/debugAndroidTest/processDebugAndroidTestResources/out/resources-debugAndroidTest.ap_\
          -R\
          @/Users/danale/Desktop/rn_crashing/node_modules/appcenter/android/build/intermediates/incremental/processDebugAndroidTestResources/resources-list-for-resources-debugAndroidTest.ap_.txt\
          --auto-add-overlay\
          --java\
          /Users/danale/Desktop/rn_crashing/node_modules/appcenter/android/build/generated/not_namespaced_r_class_sources/debugAndroidTest/processDebugAndroidTestResources/r\
          -0\
          apk\
          --output-text-symbols\
          /Users/danale/Desktop/rn_crashing/node_modules/appcenter/android/build/intermediates/symbols/androidTest/debug/R.txt\
          --no-version-vectors
  Daemon:  AAPT2 aapt2-3.2.1-4818971-osx Daemon #0
  Output:  /Users/danale/.gradle/caches/transforms-1/files-1.1/appcompat-v7-28.0.0.aar/57b086126a30313669b0da3ee77ec1b3/res/values-v28/values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found.

None of the fixes that have been suggested have helped. It seems the problem for me is in the AndroidManifest.xml file, I think, which looks like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.nfib.engage"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-feature android:name="android.hardware.telephony" android:required="false" />


    <application
        android:name=".MainApplication"
        android:appComponentFactory="androidx"
        tools:replace="android:appComponentFactory"
        android:allowBackup="true"
        android:label="@string/app_name"
        android:icon="@mipmap/ic_launcher"
        android:theme="@style/AppTheme">

        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
            android:launchMode="singleTask"
            android:exported="true"
            android:windowSoftInputMode="adjustPan">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data
                    android:scheme="https"
                    android:host="@string/link_launcher"
                    android:pathPrefix="/auth" />
                <data
                    android:scheme="https"
                    android:host="@string/link_launcher"
                    android:pathPrefix="/events" />
                <data
                    android:scheme="https"
                    android:host="@string/link_launcher"
                    android:pathPrefix="/account/surveys" />
            </intent-filter>
        </activity>
        <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>

</manifest>

@irajwani
Copy link

irajwani commented Jul 7, 2019

I'm facing the exact same error as @uendar, I've noticed that switching between compileSDK 27 and 28 is making no difference. The error . Please help.

Android resource linking failed
/Users/imadrajwani/code/reactNative/nott/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:2368: error: resource android:attr/fontVariationSettings not found.
/Users/imadrajwani/code/reactNative/nott/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:2368: error: resource android:attr/ttcIndex not found.
error: failed linking references.

@kitofers
Copy link

kitofers commented Jul 9, 2019

Thanks, this helped!
Here's a couple others that I needed, that might be commonly used:

        force 'com.google.android.gms:play-services-location:16.0.0'
        force 'com.google.android.gms:play-services-maps:16.0.0'

@alvesmarcos
Copy link

alvesmarcos commented Jul 9, 2019

@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!

@ddxxtony
Copy link

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

Thank you man, this resolved my problem,

@seasafari
Copy link

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

@stale
Copy link

stale bot commented Oct 25, 2019

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Oct 25, 2019
@stale
Copy link

stale bot commented Nov 1, 2019

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Nov 1, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Nov 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API: Settings Bug Platform: Android Android applications. Ran Commands One of our bots successfully processed a command. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests