react-native-fbsdk not compile 'com.android.support:appcompat-v7:25.0.0'



react-native版本0.51.0

React-Native-FBSDK版本0.6.3,我确实尝试了版本0.6.0

项目在安装react-native-fbsdk之前运行我在https://developers.facebook.com/docs/reaect-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

我正在做这个解决方法,而我找不到正确的方法来修复它。

将此更改为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')
}

也许也可以帮助您。

react本地项目:转到android/build.gradle
1。您所要做的就是将新的maven线添加到maven.google.com的AllProject部分
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"
        }
    }
}

在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
}

相关内容

  • 没有找到相关文章

最新更新