任务':react-native-svg:verifyReleaseResources'的React-Native执行失败

时间:2018-11-21 01:35:22

标签: android react-native react-native-android

在React-Native Android模拟器中,它运行完美。但是,当我运行以下命令时:

cd android && ./gradlew assembleRelease

我收到此错误,我不知道该怎么办

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.

编辑:更多信息

当我执行上面的命令时,我也会得到这个:

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"
}

2 个答案:

答案 0 :(得分:0)

对于RN 0.57,这应该起作用:

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

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

4.4级

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

还要检查RN changeLog是否有0.57和babel deps,请确保您正在使用babel 7。

React native upgrade from babel 6 to babel 7

还尝试清除缓存: 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

答案 1 :(得分:-1)

我将react-native-svg更新为该版本,并且可以正常运行:

"react-native-svg": "6.5.2",