android - React-native android 构建失败 : "...AAPT: error: resource android:attr/fontVariationSettings not found."

标签 android react-native

我试图在 react-native 应用程序上构建一个 Android 项目。直到今天早上一切正常。这很奇怪,因为没有更改代码但构建失败。这可能与内部依赖更新有关,但我无法弄清楚。

我试图将 compileSdkVersion 更新为 28,但这会产生更多问题,如果不是完全必要,我想避免它。

android/build.gradle

buildscript {
    ext {
        buildToolsVersion = "27.0.3"
        minSdkVersion = 21
        compileSdkVersion = 27
        targetSdkVersion = 26
        supportLibVersion = "27.1.1"
        googlePlayServicesAuthVersion = "15.0.1"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath 'com.google.gms:google-services:4.2.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

android/app/build.gradle

dependencies {
    // this is copied from
    implementation('com.onesignal:OneSignal:3.10.8') {
        // Exclude com.android.support(Android Support library) as the version range starts at 26.0.0
        //    This is due to compileSdkVersion defaulting to 23 which cant' be lower than the support library version
        //    And the fact that the default root project is missing the Google Maven repo required to pull down 26.0.0+
        exclude group: 'com.android.support'
        // Keeping com.google.android.gms(Google Play services library) as this version range starts at 10.2.1
    }
    implementation project(':react-native-onesignal')
    implementation project(':appcenter')
    implementation project(':react-native-gesture-handler')
    implementation project(':react-native-reanimated')
    implementation project(':react-native-audio-jack')
    implementation project(':react-native-firebase')
    androidTestImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test:rules:1.0.1'
    implementation project(':appcenter-crashes')
    implementation project(':appcenter-analytics')

    implementation project(':react-native-heading')
    implementation project(':react-native-billing')
    implementation project(':react-native-android-badge')
    implementation project(':react-native-sound')
    implementation project(':react-native-google-analytics-bridge')
    implementation project(':react-native-bluetooth-state')
    implementation project(':react-native-code-push')
    implementation (project(':@mapbox_react-native-mapbox-gl')){
        implementation ('com.squareup.okhttp3:okhttp:3.9.1') {
            force = true
        }
    }
    implementation project(':react-native-kontaktio')
    implementation project(':realm')
    implementation project(':rn-fetch-blob')
    implementation project(':react-native-restart')
    implementation project(':react-native-linear-gradient')
    implementation project(':react-native-keep-awake')
    implementation project(':react-native-image-crop-picker')
    implementation project(':react-native-i18n')
    implementation project(':react-native-fs')
    implementation project(':react-native-exception-handler')
    implementation project(':react-native-device-info')
    implementation (project(':react-native-camera')){
        exclude group: "com.android.support"
    }
    implementation project(':react-native-android-location-services-dialog-box')
    implementation project(':lottie-react-native')
    implementation project(':react-native-google-signin')
    implementation project(':react-native-fbsdk')
    implementation project(':react-native-config')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation 'com.google.firebase:firebase-core:16.0.7'
    implementation "com.google.firebase:firebase-invites:16.1.0"
}

我希望 Android 构建能够顺利通过。

最佳答案

这似乎与 Google 发布新版本的 Play 服务有关,因为您不想更新 compileSdkVersion。

试试这个:

implementation(project(":react-native-device-info"),  {
  exclude group: "com.google.android.gms"
})
implementation "com.google.android.gms:play-services-gcm:16.0.0"

更多详细信息,您可以引用this

关于android - React-native android 构建失败 : "...AAPT: error: resource android:attr/fontVariationSettings not found.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56684107/

相关文章:

react-native - React Native 开发服务器返回响应错误代码 :500

reactjs - 将按钮链接到另一个页面

android - Android NullPointerException处理

android - android webview是否支持html5视频播放?

java - Android中通过代码或xml生成的界面?

android - 避免 Android Market 对位置的可选使用进行过滤

reactjs - 使用 React.js 设置 useContext 和 useState 的正确方法?

ios - 当应用程序被用户强制退出时如何处理推送通知? [iOS]

reactjs - 拉动 ScrollView 以显示 View - React Native

android - 获取 Facebook 登录用户的 JSONObject 值