React native Android Generate Signed APK 给出资源错误
Posted
技术标签:
【中文标题】React native Android Generate Signed APK 给出资源错误【英文标题】:React native Android Generate Signed APK giving Resource error 【发布时间】:2018-11-22 17:38:08 【问题描述】:我已经在 React Native 上完成了我的 android 项目,并在为 Signed Apk 编译项目时发现了这个错误。
> Task :react-native-video:compileReleaseJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.
/Users/kedardave/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/e10f37597a16932be24db019d75c890a/res/values-v26/values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found.
/Users/kedardave/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/e10f37597a16932be24db019d75c890a/res/values-v26/values-v26.xml:13:5-16:13: AAPT: error: resource android:attr/colorError not found.
/Users/kedardave/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/e10f37597a16932be24db019d75c890a/res/values-v26/values-v26.xml:17:5-93:AAPT: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
/Users/kedardave/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/e10f37597a16932be24db019d75c890a/res/values/values.xml:251:5-69: AAPT: error: resource android:attr/fontStyle not found.
/Users/kedardave/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/e10f37597a16932be24db019d75c890a/res/values/values.xml:251:5-69: AAPT: error: resource android:attr/font not found.
/Users/kedardave/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/e10f37597a16932be24db019d75c890a/res/values/values.xml:251:5-69: AAPT: error: resource android:attr/fontWeight not found.
error: failed linking references.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-keep-awake:verifyReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2m 42s
132 actionable tasks: 100 executed, 32 up-to-date
这些是我遇到的问题,这些是关于资源的,我不知道如何解决它。似乎是 targetSDK 的版本问题,但无法弄清楚
【问题讨论】:
【参考方案1】:将项目的 build.gradle 的 supportLibVersion 更改为 27.1.1
编辑
如何将以下代码添加到项目的 build.gradle 中,
subprojects
afterEvaluate project ->
if (project.hasProperty("android"))
android
compileSdkVersion 27
buildToolsVersion "27.1.1"
【讨论】:
我已将支持库 build.gradle 更改为 27.1.1 但仍然无法正常工作以上是关于React native Android Generate Signed APK 给出资源错误的主要内容,如果未能解决你的问题,请参考以下文章
使用 react-native run-android 运行时出现 React-Native 错误
react-native run-android上的React Native错误
解决 React-Native: Android project not found. Maybe run react-native android first?
React Native 项目 Android Gradle 失败(React-Native-Reanimated Fail)
react-native 使用react-native run-android 启动项目 报错 Android project not found