4

In React-Native Android Emulator, it works perfectly. However, when I run the following:

cd android && ./gradlew assembleRelease

I get this error and I don't know what to do

error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.
/Users/bryan/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/1b8e5cb1180cba6c93c5f4bac1122fec/res/values-v26/values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found.

/Users/bryan/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/1b8e5cb1180cba6c93c5f4bac1122fec/res/values-v26/values-v26.xml:13:5-16:13: AAPT: error: resource android:attr/colorError not found.

/Users/bryan/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/1b8e5cb1180cba6c93c5f4bac1122fec/res/values-v26/values-v26.xml:17:5-93: AAPT: error: style attribute 'android:attr/keyboardNavigationCluster' not found.

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

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

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

error: failed linking references.

EDIT: More info

When I do the above command I also get this:

Configure project :react-native-svg 
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (23.0.1) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.4.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '23.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

Packag.e.json

  "react-native-svg": "^6.3.1",
  "react-native": "^0.57.1"
}
"devDependencies": {
  "babel-jest": "23.2.0",
  "babel-preset-react-native": "4.0.0",
  "jest": "23.2.0",
  "react-test-renderer": "16.3.1"
}
bryan
  • 8,879
  • 18
  • 83
  • 166
  • Add your gradle version and gradle tools version and RN version to your question – Florin Dobre Nov 21 '18 at 10:14
  • If you are using RN 0.57 check this https://stackoverflow.com/a/52767101/1979861 – Florin Dobre Nov 21 '18 at 10:18
  • @FlorinDobre how do I find the Gradle tools version? I'm seeing a lot of different numbers in my files. I checked out this post but it doesn't seem to be the same issue I'm having. My build.gradle has `classpath 'com.android.tools.build:gradle:3.1.4'` int it – bryan Nov 21 '18 at 18:32
  • I added an answer with the settings that work for me. – Florin Dobre Nov 22 '18 at 09:06

2 Answers2

0

For RN 0.57 this should work:

minSdkVersion = 17
compileSdkVersion = 27
targetSdkVersion = 27
supportLibVersion = "27.0.3"

classpath 'com.android.tools.build:gradle:3.1.4'

Gradle 4.4

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

Check also the RN changeLog for 0.57 and babel deps, make sure you are using babel 7.

React native upgrade from babel 6 to babel 7

Also try to clean the cache: rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/metro-* && rm -rf $TMPDIR/haste-* && watchman watch-del-all && rm -rf ios/build && rm -rf node_modules && yarn install && npm start -- --reset-cache

Florin Dobre
  • 9,872
  • 3
  • 59
  • 93
  • same config as you, migrated to babel 7, still getting the same error – vbvx Nov 22 '18 at 14:22
  • clean and cleanBuildCache is the first thing i do before everything else when I run into some gradle issues. Oh i see that you also edited your answer – vbvx Nov 22 '18 at 16:45
  • the craziest is that when I do run assembleRelease from android studio it works – vbvx Nov 22 '18 at 17:07
0

I updated my react-native-svg to this version and it worked:

"react-native-svg": "6.5.2",
bryan
  • 8,879
  • 18
  • 83
  • 166