react-native version 0.51.0
react-native-fbsdk版本0.6.3,我确实尝试了版本0.6.0
在安装react-native-fbsdk之前运行项目 我在https://developers.facebook.com/docs/react-native/configure-android-current
中执行了所有步骤这是react-native-fbsdk / build.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:appcompat:25.0.0'
compile 'com.android.support:design:25.0.0'
compile 'com.facebook.react:react-native:+' // support react-native-v0.22-rc+
compile('com.facebook.android:facebook-android-sdk:4.+')
}
这是app / build.gradle
dependencies {
compile project(':react-native-fbsdk')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
}
并且错误是......
Error:Error:Failed to resolve: com.android.support:appcompat-v7:27.0.1
Error:Error:Failed to resolve: com.android.support:appcompat:25.0.0
Error:Error:Failed to resolve: com.android.support:customtabs:27.0.1
Error:Error:Failed to resolve: com.android.support:cardview-v7:27.0.1
Error:Error:Failed to resolve: com.android.support:support-v4:27.0.1
Error:Error:Failed to resolve: com.android.support:support-core-utils:27.0.1
Error:Error:Failed to resolve: com.android.support:support-annotations:27.0.1
Error:Error:Failed to resolve: com.android.support:appcompat-v7:27.0.1
Error:Error:line (19)Failed to resolve: com.android.support:appcompat:25.0.0
Error:Error:Failed to resolve: com.android.support:customtabs:27.0.1
Error:Error:Failed to resolve: com.android.support:cardview-v7:27.0.1
Error:Error:Failed to resolve: com.android.support:support-v4:27.0.1
Error:Error:Failed to resolve: com.android.support:support-core-utils:27.0.1
答案 0 :(得分:0)
我正在做这个解决方法,而我找不到正确的解决方法。
将此更改更改为node_modules/react-native-fbsdk/android/build.gradle
:
//Before
dependencies {
...
compile('com.facebook.android:facebook-android-sdk:4+')
}
//After
dependencies {
...
compile('com.facebook.android:facebook-android-sdk:4.28.0')
}
也许可以帮助你。
答案 1 :(得分:0)
React Native Project:转到android/build.gradle
1。您所要做的就是在maven
的allprojects部分添加一条新的maven.google.com
行
2.添加resolutionStrategy
将有助于限制android:facebook-android-sdk:4.28.0
allprojects {
repositories {
mavenLocal()
jcenter()
configurations.all {
resolutionStrategy {
force 'com.facebook.android:facebook-android-sdk:4.28.0'
}
}
maven {
url "https://maven.google.com"
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
答案 2 :(得分:0)
将build.gradle中的com.android.support:appcompat
更改为
dependencies {
compile project(':react-native-fbsdk')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:27.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
}