【问题标题】:"resource android:attr/fontVariationSettings not found." in react-native“资源 android:attr/fontVariationSettings 未找到。”在本机反应
【发布时间】:2019-11-02 01:14:30
【问题描述】:

我有一个 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:错误:资源 android:attr/fontVariationSettings 未找到。

.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.0.2.aar/d1dde4fd0fa50f7f7336597688c557a9/res/values/value s.xml:252:5-69:AAPT:错误:找不到资源 android:attr/ttcIndex。

错误:链接引用失败。

FAILURE:构建失败并出现异常。

  • 出了什么问题:任务 ':app:processDebugResources' 执行失败。

    处理资源失败,详见上面的 aapt 输出。

主要配置如下:

"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,但我不能,因为我的prohect有很多依赖项,其中一些不支持AndroidX。

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

【问题讨论】:

    标签: android react-native aapt


    【解决方案1】:

    这对我有帮助

    在文件 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

    【讨论】:

    • 谢谢@Vladimir Podolyak,它有效,只需将googlePlayServicesVersion=12.0.1 添加到gradle.properties。您能解释一下为什么需要添加googlePlayServicesVersion=12.0.1吗?
    • 或者给我一些可以解释的链接。
    • 这个链接解释一下link
    猜你喜欢
    • 1970-01-01
    • 2018-08-18
    • 2019-05-01
    • 1970-01-01
    • 2019-12-02
    • 2021-05-04
    • 2019-11-02
    • 1970-01-01
    • 2020-11-28
    相关资源
    最近更新 更多