Facebook SDK导入错误

时间:2015-09-30 17:21:37

标签: java android facebook maven android-studio

当我尝试将FB SDK导入我的项目时出现问题。

执行项目清理后,这是一个日志。

>Error:A problem occurred configuring root project 'XXX'.

> Could not resolve all dependencies for configuration ':_debugCompile'.

   > Could not find com.parse.bolts:bolts-android:1.2.0.
     Searched in the following locations:
         file:/Users/OOO/Library/Android/sdk/extras/android/m2repository
/com/parse/bolts/bolts-android/1.2.0/bolts-android-1.2.0.pom
         file:/Users/OOO/Library/Android/sdk/extras/android/m2repository
/com/parse/bolts/bolts-android/1.2.0/bolts-android-1.2.0.jar
         file:/Users/OOO/Library/Android/sdk/extras/google/m2repository
/com/parse/bolts/bolts-android/1.2.0/bolts-android-1.2.0.pom
         file:/Users/OOO/Library/Android/sdk/extras/google/m2repository
/com/parse/bolts/bolts-android/1.2.0/bolts-android-1.2.0.jar
     Required by:
         :XXX:unspecified > com.facebook.android:facebook:4.6.0

这是我的导入步骤

1)import moudule

2)添加依赖项:facebook

3)修改gradle.properties如下

ANDROID_BUILD_SDK_VERSION = 23
ANDROID_BUILD_TOOLS_VERSION = 23.0.1
ANDROID_BUILD_MIN_SDK_VERSION = 15
ANDROID_BUILD_TARGET_SDK_VERSION =2

似乎不起作用......有什么方法可以解决这个问题吗?

我的build.gradle文件:

{
apply plugin: 'android'
buildscript {
repositories {
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.3.0'
}
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile files('libs/gson-2.2.2.jar')
compile 'com.google.android.gms:play-services:7.3.0'
compile files('libs/GoogleConversionTrackingSdk-2.2.4.jar')
compile project(':facebook')
}

android {
compileSdkVersion 18
buildToolsVersion "21.1.1"

sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        resources.srcDirs = ['src']
        aidl.srcDirs = ['src']
        renderscript.srcDirs = ['src']
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
    }

    instrumentTest.setRoot('tests')

    debug.setRoot('build-types/debug')
    release.setRoot('build-types/release')
}
}

2 个答案:

答案 0 :(得分:1)

尝试在foreach($aQueryParams as $key=>&$value){ $stmt->bindParam($key, $value); } 文件中添加此依赖关系

builld.gradle

将此或您的compile 'com.facebook.android:facebook-android-sdk:3.21.1' 删除为您为Facebook SDK添加的库

module

答案 1 :(得分:0)

我找到了解决这个问题的另一种方法。我在我的项目facebook文件夹下创建了一个libs文件夹。然后将bolt-android:1.2.0.jar放入libs文件夹。

并在我的项目facebook文件夹下修改build.gradle。看起来似乎有用。

dependencies {
    compile 'com.parse.bolts:bolts-android:1.2.0'
}