安装 react-native-fbsdk 后 gradle build 失败,错误为 Error retrieving parent for item: No resource found that
Posted
技术标签:
【中文标题】安装 react-native-fbsdk 后 gradle build 失败,错误为 Error retrieving parent for item: No resource found that match the given name【英文标题】:gradle build failed after installing react-native-fbsdk with error of Error retrieving parent for item: No resource found that matches the given name 【发布时间】:2018-02-14 21:43:22 【问题描述】:我在安装fbsdk后尝试编译一个react native android项目,遇到了这个错误:
/Users/ethanwang/Github/reactnative/Glever_RNI/Glever/android/app/build/intermediates/res/merged/debug/values-v24/values-v24.xml
Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
/Users/ethanwang/Github/reactnative/Glever_RNI/Glever/android/app/build/intermediates/res/merged/debug/values-v26/values-v26.xml
Error:(15, 21) No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.
Error:(15, 21) No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
我已经确保 appcompact 的版本与 gradle 中的 sdk 版本匹配
我也关注了这个帖子Facebook Sdk Android Error Building 强制使用“com.facebook.android:facebook-android-sdk:4.22.1”:
android
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig
applicationId "com.resure.glever"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
ndk
abiFilters "armeabi-v7a", "x86"
...
dependencies
compile "com.android.support:appcompat-v7:23.0.1"
compile(project(':react-native-fbsdk'))
exclude(group: 'com.facebook.android', module: 'facebook-android-sdk')
compile "com.facebook.android:facebook-android-sdk:4.22.1"
还有什么可能导致这个问题?
【问题讨论】:
尝试重建。只需删除所有构建文件夹或执行“gradlew clean”并重试 @ByteHamster 是的,我已经尝试过了,但仍然没有运气...... 【参考方案1】:我通过升级到 sdk 26 修复了它
compileSdkVersion 26
buildToolsVersion "26.0.1"
和 appcompat:
dependencies
compile "com.android.support:appcompat-v7:26.0.1"
【讨论】:
谢谢,这行得通,但我有一个DexException: Cannot merge new index 65536 into a non-jumbo instruction
,这里的答案是***.com/questions/17320088/…以上是关于安装 react-native-fbsdk 后 gradle build 失败,错误为 Error retrieving parent for item: No resource found that的主要内容,如果未能解决你的问题,请参考以下文章
无法读取未定义的属性“canShow” - React-Native-FBSDK - iOS
未找到 react-native-fbsdk FBSDKCoreKit 和 FBSDKShareKit
react-native-fbsdk:“ld:找不到-l-lRNSDKCoreKit的库”
react-native-fbsdk / Facebook iOS SDK - 未定义不是对象(评估'LoginManager.logInWithReadPermissions')