android - react native 中的 "resource android:attr/fontVariationSettings not found."

标签 android react-native aapt

我有一个 react-native 项目,它昨天在 android 上工作正常,但是今天当我运行 react-native run-android 时发生错误。今天在android上运行之前,没有任何改变,只是在AndroidStudio中打开它。报错如下:

.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.

主要配置如下:

"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

我花了很多时间解决它,但没有成功。

大多数解决方案都是将 android 升级到 AndroidX,但我不能,因为我的项目有很多依赖项,其中一些不支持 AndroidX。

所以我想知道为什么在我运行它时需要android:attr/ttcIndex。以及如何修复它并且不升级android版本并保持compileSdkVersion 27

最佳答案

这对我有帮助

在文件 android/gradle.properties 的顶部

googlePlayServicesVersion=12.0.1

并创建新的 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/应用程序/src/main/res

关于android - react native 中的 "resource android:attr/fontVariationSettings not found.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56665267/

相关文章:

javascript - 关于如何使用 Phonegap 在 Android 应用程序中捕获屏幕的建议?

reactjs - 在组件外部访问的 Redux 存储返回初始状态

reactjs - 如何在 React Native 中使用 componentWillUnmount?

java - 在java程序中使用android aapt

android - 更新到 Android Studio,现在收到 AAPT : error: resource attr/type not found error for Navigation

android - 当我尝试从 Eclipse 导出我的 Android 应用程序时 aapt.exe 崩溃

android - 从 eclipse 中检索 android-sdk 的保存位置

android - 如何确定 Android 版本的修订号?

java - 获取 ListItem 在自定义 SimpleLayout 中的位置

css - 对齐元素 flex end react native