0

得到这个:错误:(15、21)没有找到与给定名称匹配的资源: attr 'android:keyboardNavigationCluster'

使用 Android Studio 3.0.1,react-native 0.48.2。

我当前的 build.gradle(app):

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"

    defaultConfig {
        applicationId "com.awesome"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    ...
}

依赖项:

dependencies {
    compile(project(":react-native-google-signin")){
        exclude group: "com.google.android.gms" // very important
    }
    compile project(':react-native-splash-screen')
    compile(project(':react-native-fbsdk')){
        exclude(group: 'com.facebook.android', module: 'facebook-android-sdk')
    }
    compile "com.facebook.android:facebook-android-sdk:4.29.0"
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile("com.android.support:appcompat-v7:26.0.2"){
        force = true
    }
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile project(':react-native-splash-screen')
    compile 'com.google.android.gms:play-services-auth:11.6.2'
    compile project(':react-native-spinkit')
    compile project(':react-native-push-notification')
    compile ('com.google.android.gms:play-services-gcm:11.6.2') {
        force = true;
    }
    compile project(':react-native-google-places')
    compile "com.google.android.gms:play-services-places:11.6.2"
    compile "com.google.android.gms:play-services-location:11.6.2"
    compile "com.google.android.gms:play-services-maps:11.6.2"
    compile project(':react-native-android-location-services-dialog-box')
    compile project(':react-native-svg')
    compile (project(':react-native-mauron85-background-geolocation')){
        exclude(group: 'com.google.android', module: 'android')
    }
}

gradlew 应用程序:依赖项

+--- project :react-native-google-signin
|    +--- com.android.support:appcompat-v7:23.0.1 -> 26.0.2
|    |    +--- com.android.support:support-annotations:26.0.2 -> 27.0.2
|    |    +--- com.android.support:support-v4:26.0.2 -> 27.0.2
|    |    |    +--- com.android.support:support-compat:27.0.2
|    |    |    |    +--- com.android.support:support-annotations:27.0.2
|    |    |    |    \--- android.arch.lifecycle:runtime:1.0.3
|    |    |    |         +--- android.arch.lifecycle:common:1.0.3
|    |    |    |         \--- android.arch.core:common:1.0.0
|    |    |    +--- com.android.support:support-media-compat:27.0.2
|    |    |    |    +--- com.android.support:support-annotations:27.0.2
|    |    |    |    \--- com.android.support:support-compat:27.0.2 (*)
|    |    |    +--- com.android.support:support-core-utils:27.0.2
|    |    |    |    +--- com.android.support:support-annotations:27.0.2
|    |    |    |    \--- com.android.support:support-compat:27.0.2 (*)
|    |    |    +--- com.android.support:support-core-ui:27.0.2
|    |    |    |    +--- com.android.support:support-annotations:27.0.2
|    |    |    |    \--- com.android.support:support-compat:27.0.2 (*)
|    |    |    \--- com.android.support:support-fragment:27.0.2
|    |    |         +--- com.android.support:support-compat:27.0.2 (*)
|    |    |         +--- com.android.support:support-core-ui:27.0.2 (*)
|    |    |         +--- com.android.support:support-core-utils:27.0.2 (*)
|    |    |         \--- com.android.support:support-annotations:27.0.2
|    |    +--- com.android.support:support-vector-drawable:26.0.2
|    |    |    +--- com.android.support:support-annotations:26.0.2 -> 27.0.2
|    |    |    \--- com.android.support:support-compat:26.0.2 -> 27.0.2 (*)
|    |    \--- com.android.support:animated-vector-drawable:26.0.2
|    |         +--- com.android.support:support-vector-drawable:26.0.2 (*)
|    |         \--- com.android.support:support-core-ui:26.0.2 -> 27.0.2 (*)
|    \--- com.facebook.react:react-native:+ -> 0.51.0
|         +--- javax.inject:javax.inject:1
|         +--- com.android.support:appcompat-v7:23.0.1 -> 26.0.2 (*)
|         +--- com.facebook.fbui.textlayoutbuilder:textlayoutbuilder:1.0.0
|         |    \--- com.facebook.fbui.textlayoutbuilder:staticlayout-proxy:1.0
|         +--- com.facebook.fresco:fresco:1.3.0
|         |    +--- com.facebook.fresco:drawee:1.3.0
|         |    |    \--- com.facebook.fresco:fbcore:1.3.0
|         |    +--- com.facebook.fresco:fbcore:1.3.0
|         |    \--- com.facebook.fresco:imagepipeline:1.3.0
|         |         +--- com.parse.bolts:bolts-tasks:1.4.0
|         |         +--- com.facebook.fresco:fbcore:1.3.0
|         |         \--- com.facebook.fresco:imagepipeline-base:1.3.0
|         |              +--- com.parse.bolts:bolts-tasks:1.4.0
|         |              \--- com.facebook.fresco:fbcore:1.3.0
|         +--- com.facebook.fresco:imagepipeline-okhttp3:1.3.0
|         |    +--- com.squareup.okhttp3:okhttp:3.6.0
|         |    |    \--- com.squareup.okio:okio:1.11.0 -> 1.13.0
|         |    +--- com.facebook.fresco:fbcore:1.3.0
|         |    \--- com.facebook.fresco:imagepipeline:1.3.0 (*)
|         +--- com.facebook.soloader:soloader:0.1.0
|         +--- com.google.code.findbugs:jsr305:3.0.0
|         +--- com.squareup.okhttp3:okhttp:3.6.0 (*)
|         +--- com.squareup.okhttp3:okhttp-urlconnection:3.6.0
|         |    \--- com.squareup.okhttp3:okhttp:3.6.0 (*)
|         +--- com.squareup.okio:okio:1.13.0
|         \--- org.webkit:android-jsc:r174650
+--- project :react-native-splash-screen
|    +--- com.android.support:appcompat-v7:23.4.0 -> 26.0.2 (*)
|    \--- com.facebook.react:react-native:+ -> 0.51.0 (*)
+--- project :react-native-fbsdk
|    +--- com.android.support:appcompat-v7:25.0.0 -> 26.0.2 (*)
|    \--- com.facebook.react:react-native:+ -> 0.51.0 (*)
+--- com.facebook.android:facebook-android-sdk:4.29.0
|    +--- com.facebook.android:facebook-core:4.29.0
|    |    +--- com.parse.bolts:bolts-android:1.4.0
|    |    |    +--- com.parse.bolts:bolts-tasks:1.4.0
|    |    |    \--- com.parse.bolts:bolts-applinks:1.4.0
|    |    |         \--- com.parse.bolts:bolts-tasks:1.4.0
|    |    +--- com.android.support:support-annotations:27.0.1 -> 27.0.2
|    |    \--- com.android.support:support-core-utils:27.0.1 -> 27.0.2 (*)
|    +--- com.facebook.android:facebook-common:4.29.0
|    |    +--- com.facebook.android:facebook-core:4.29.0 (*)
|    |    +--- com.android.support:appcompat-v7:27.0.1 -> 26.0.2 (*)
|    |    +--- com.android.support:cardview-v7:27.0.1
|    |    |    \--- com.android.support:support-annotations:27.0.1 -> 27.0.2
|    |    +--- com.android.support:customtabs:27.0.1
|    |    |    +--- com.android.support:support-compat:27.0.1 -> 27.0.2 (*)
|    |    |    \--- com.android.support:support-annotations:27.0.1 -> 27.0.2
|    |    +--- com.android.support:support-v4:27.0.1 -> 27.0.2 (*)
|    |    \--- com.google.zxing:core:3.3.0
|    +--- com.facebook.android:facebook-login:4.29.0
|    |    +--- com.facebook.android:facebook-core:4.29.0 (*)
|    |    \--- com.facebook.android:facebook-common:4.29.0 (*)
|    +--- com.facebook.android:facebook-share:4.29.0
|    |    +--- com.facebook.android:facebook-core:4.29.0 (*)
|    |    \--- com.facebook.android:facebook-common:4.29.0 (*)
|    +--- com.facebook.android:facebook-places:4.29.0
|    |    \--- com.facebook.android:facebook-core:4.29.0 (*)
|    +--- com.facebook.android:facebook-applinks:4.29.0
|    |    \--- com.facebook.android:facebook-core:4.29.0 (*)
|    \--- com.facebook.android:facebook-messenger:4.29.0
|         \--- com.facebook.android:facebook-core:4.29.0 (*)
+--- com.android.support:appcompat-v7:26.0.2 (*)
+--- com.facebook.react:react-native:+ -> 0.51.0 (*)
+--- com.google.android.gms:play-services-auth:11.6.2
|    +--- com.google.android.gms:play-services-auth-api-phone:11.6.2
|    |    +--- com.google.android.gms:play-services-base:11.6.2
|    |    |    +--- com.google.android.gms:play-services-basement:11.6.2
|    |    |    |    +--- com.android.support:support-v4:25.2.0 -> 27.0.2 (*)
|    |    |    |    \--- com.google.android.gms:play-services-basement-license:11.6.2
|    |    |    +--- com.google.android.gms:play-services-tasks:11.6.2
|    |    |    |    +--- com.google.android.gms:play-services-basement:11.6.2 (*)
|    |    |    |    \--- com.google.android.gms:play-services-tasks-license:11.6.2
|    |    |    \--- com.google.android.gms:play-services-base-license:11.6.2
|    |    +--- com.google.android.gms:play-services-basement:11.6.2 (*)
|    |    +--- com.google.android.gms:play-services-tasks:11.6.2 (*)
|    |    \--- com.google.android.gms:play-services-auth-api-phone-license:11.6.2
|    +--- com.google.android.gms:play-services-auth-base:11.6.2
|    |    +--- com.google.android.gms:play-services-base:11.6.2 (*)
|    |    +--- com.google.android.gms:play-services-basement:11.6.2 (*)
|    |    +--- com.google.android.gms:play-services-tasks:11.6.2 (*)
|    |    \--- com.google.android.gms:play-services-auth-base-license:11.6.2
|    +--- com.google.android.gms:play-services-base:11.6.2 (*)
|    +--- com.google.android.gms:play-services-basement:11.6.2 (*)
|    \--- com.google.android.gms:play-services-tasks:11.6.2 (*)
+--- project :react-native-spinkit
|    +--- com.facebook.react:react-native:+ -> 0.51.0 (*)
|    \--- com.github.ybq:Android-SpinKit:1.1.0
+--- project :react-native-push-notification
|    +--- com.android.support:appcompat-v7:23.1.1 -> 26.0.2 (*)
|    +--- com.facebook.react:react-native:+ -> 0.51.0 (*)
|    +--- com.google.android.gms:play-services-gcm:+ -> 11.6.2
|    |    +--- com.google.android.gms:play-services-base:11.6.2 (*)
|    |    +--- com.google.android.gms:play-services-basement:11.6.2 (*)
|    |    +--- com.google.android.gms:play-services-iid:11.6.2
|    |    |    +--- com.google.android.gms:play-services-base:11.6.2 (*)
|    |    |    +--- com.google.android.gms:play-services-basement:11.6.2 (*)
|    |    |    \--- com.google.android.gms:play-services-iid-license:11.6.2
|    |    \--- com.google.android.gms:play-services-gcm-license:11.6.2
|    \--- me.leolin:ShortcutBadger:1.1.8
+--- com.google.android.gms:play-services-gcm:11.6.2 (*)
+--- project :react-native-google-places
|    +--- com.facebook.react:react-native:+ -> 0.51.0 (*)
|    +--- com.google.android.gms:play-services-base:10.2.4 -> 11.6.2 (*)
|    +--- com.google.android.gms:play-services-places:10.2.4 -> 11.6.2
|    |    +--- com.google.android.gms:play-services-base:11.6.2 (*)
|    |    +--- com.google.android.gms:play-services-basement:11.6.2 (*)
|    |    +--- com.google.android.gms:play-services-maps:11.6.2
|    |    |    +--- com.google.android.gms:play-services-base:11.6.2 (*)
|    |    |    +--- com.google.android.gms:play-services-basement:11.6.2 (*)
|    |    |    \--- com.google.android.gms:play-services-maps-license:11.6.2
|    |    +--- com.google.android.gms:play-services-tasks:11.6.2 (*)
|    |    \--- com.google.android.gms:play-services-places-license:11.6.2
|    +--- com.google.android.gms:play-services-location:10.2.4 -> 11.6.2
|    |    +--- com.google.android.gms:play-services-base:11.6.2 (*)
|    |    +--- com.google.android.gms:play-services-basement:11.6.2 (*)
|    |    +--- com.google.android.gms:play-services-tasks:11.6.2 (*)
|    |    \--- com.google.android.gms:play-services-location-license:11.6.2
|    \--- com.google.maps.android:android-maps-utils:0.3.4
+--- com.google.android.gms:play-services-places:11.6.2 (*)
+--- com.google.android.gms:play-services-location:11.6.2 (*)
+--- com.google.android.gms:play-services-maps:11.6.2 (*)
+--- project :react-native-android-location-services-dialog-box
|    \--- com.facebook.react:react-native:+ -> 0.51.0 (*)
+--- project :react-native-svg
|    +--- com.android.support:appcompat-v7:25.3.1 -> 26.0.2 (*)
|    \--- com.facebook.react:react-native:+ -> 0.51.0 (*)
+--- project :react-native-mauron85-background-geolocation
|    +--- com.facebook.react:react-native:+ -> 0.51.0 (*)
|    +--- com.android.support:support-v4:+ -> 27.0.2 (*)
|    +--- com.google.android.gms:play-services-location:+ -> 11.6.2 (*)
|    +--- com.github.tony19:logback-android-core:1.1.1-6
|    +--- com.github.tony19:logback-android-classic:1.1.1-6
|    |    +--- com.github.tony19:logback-android-core:1.1.1-6
|    |    \--- com.github.tony19:apktool-lib:1.4.4-3
|    \--- org.slf4j:slf4j-api:1.7.21
\--- com.google.firebase:firebase-core:11.6.2
     \--- com.google.firebase:firebase-analytics:11.6.2
          +--- com.google.android.gms:play-services-basement:11.6.2 (*)
          +--- com.google.firebase:firebase-common:11.6.2
          |    +--- com.google.android.gms:play-services-basement:11.6.2 (*)
          |    +--- com.google.android.gms:play-services-tasks:11.6.2 (*)
          |    \--- com.google.firebase:firebase-common-license:11.6.2
          +--- com.google.firebase:firebase-analytics-impl:11.6.2
          |    +--- com.google.android.gms:play-services-basement:11.6.2 (*)
          |    +--- com.google.firebase:firebase-iid:11.6.2
          |    |    +--- com.google.android.gms:play-services-basement:11.6.2 (*)
          |    |    +--- com.google.firebase:firebase-common:11.6.2 (*)
          |    |    +--- com.google.android.gms:play-services-tasks:11.6.2 (*)
          |    |    \--- com.google.firebase:firebase-iid-license:11.6.2
          |    +--- com.google.firebase:firebase-common:11.6.2 (*)
          |    +--- com.google.android.gms:play-services-tasks:11.6.2 (*)
          |    \--- com.google.firebase:firebase-analytics-impl-license:11.6.2
          \--- com.google.firebase:firebase-analytics-license:11.6.2

尝试了许多解决方案,如: 找不到与给定名称匹配的资源:attr 'android:keyboardNavigationCluster'。更新到支持库 26.0.0 时

没有任何效果!

在依赖项中没有红色下划线。

对这个案例有什么具体建议吗?非常感谢!

编辑: 有关该错误的更多信息:(不得不提一下,这似乎是 react-native-fbsdk 包中的问题)

错误截图

4

1 回答 1

0

Google Play 服务 11.6.2 依赖于支持库 27.0.2。但仅限于其中一些。

然后你强制 appcompat-v7 支持库到版本 26.0.2。这会导致冲突。

所有导入的支持库都需要有相同的版本,否则会引用其他支持库中不存在的代码和资源(如样式属性)。GMS + Firebase 也是如此。

现在将您的 appcompat-v7 版本升级到 27.0.2 并在未来保持一致。

compile("com.android.support:appcompat-v7:27.0.2") {
    force = true
}

正如支持库版本 26 需要编译 SDK 版本 26,支持库版本 27 要求您的项目针对 SDK 版本 27 进行编译。

compileSdkVersion 27

这反过来可能需要 27+ 的构建工具。

buildToolsVersion "27.0.0"

“可能需要”意味着

  • 我没有检查
  • Android Gradle 插件 3.0.0 自动选择至少所需的最小值(因此您可以完全删除该行)
于 2017-12-14T10:11:19.713 回答