3
votes

I had a third-party dependency (react-native-admob) which specified in its build.gradle file the following: com.google.android.gms:play-services-ads:+. Taking a look over at the Google Android APIs release notes page, there were breaking updates to the whole com.google.android.gms group of APIs on 17th June 2019.

I run './gradlew assembleDebug' got error:

/Users/yons/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/8cb1ac92f08bb5fb26b003aaf1d22a69/res/values/values.xml:251:5-69: AAPT: error: resource android:attr/fontVariationSettings not found.

/Users/yons/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/8cb1ac92f08bb5fb26b003aaf1d22a69/res/values/values.xml:251:5-69: AAPT: error: resource android:attr/ttcIndex not found.

To fix my issue, I added the following to my android/app/build.gradle file:

configurations.all {
    resolutionStrategy.force 'com.google.android.gms:play-services-ads:17.2.1'
}

Now, I run './gradlew assembleDebug' works fine. But I run './gradlew assembleRelease' got an error:

/Users/yons/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/8cb1ac92f08bb5fb26b003aaf1d22a69/res/values/values.xml:251:5-69: AAPT: error: resource android:attr/fontVariationSettings not found.

/Users/yons/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/8cb1ac92f08bb5fb26b003aaf1d22a69/res/values/values.xml:251:5-69: AAPT: error: resource android:attr/ttcIndex not found.

error: failed linking references.

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':react-native-admob:verifyReleaseResources'. com.android.ide.common.process.ProcessException: Failed to execute aapt

How can I solve it?

1

1 Answers

1
votes

The root cause is related migration to Androidx, google play service updated to androidX This problem belongs to react-native-device-info? best option is to upgrade react-native-device-info using

  1. yarn upgrade [email protected]
  2. cd android && gradlew clean
  3. react-native run-android

After which you either change it like explained in the answer above. like so

implementation(project(":react-native-admob"),  {
        exclude group: "com.google.android.gms"
})
implementation "com.google.android.gms:play-services-ads:16.0.0"