4

I have a react-native project and it works ok yesterday for android, But error happens today when i run react-native run-android. Before I run it on android today ,nothing is changed,only open it in AndroidStudio. The Error as following:

.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.0.2.aar/d1dde4fd0fa50f7f7336597688c557a9/res/values/value s.xml:252:5-69: AAPT: error: resource android:attr/fontVariationSettings not found.

.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.0.2.aar/d1dde4fd0fa50f7f7336597688c557a9/res/values/value s.xml:252: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 ':app:processDebugResources'.

    Failed to process resources, see aapt output above for details.

And the main config as the following:

"react": "16.6.3",
"react-native": "0.57.8"

gradle plugin:com.android.tools.build:gradle:3.1.0

compileSdkVersion 27
buildToolsVersion "27.0.3"
minSdkVersion 19
targetSdkVersion 27

I spent a lot of time to resolved it, but failed.

Most resolutions are that upgrade android to AndroidX,But i cannot,because my prohect have many dependencies,and some of them are not support AndroidX.

So I want to know why need android:attr/ttcIndex when i run it.And how to fix it and donot upgapde android version and keep compileSdkVersion 27

Leo
  • 835
  • 1
  • 12
  • 31

1 Answers1

5

This helped me

in the top of file android/gradle.properties

googlePlayServicesVersion=12.0.1

And create new index.android.bundle

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

  • Thank you @Vladimir Podolyak, It works, only add `googlePlayServicesVersion=12.0.1` into gradle.properties.Could you explain why need to add `googlePlayServicesVersion=12.0.1`? – Leo Jun 20 '19 at 01:23
  • Or give me some links which can explain it. – Leo Jun 20 '19 at 01:30
  • This link is explain it [link](https://medium.com/@yathousen/the-day-google-decided-to-shake-the-react-native-community-4ba5cdd33388) – Vladimir Podolyak Jul 01 '19 at 06:25