2017-08-30 25 views
1

我正在Android Studio中的Android应用程序中创建一个Facebook登录选项。当我把在Android应用程序中将facebook依赖项放入时出错

compile group: 'com.facebook.android', name: 'facebook-android-sdk', version: '4.26.0' 

依存性的build.gradle,错误被如来: -

Error:Failed to resolve: com.facebook.android:facebook-android-sdk:4.26.0 

的原因是什么。

的gradle这个文件是: -

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.1" 
    defaultConfig { 
     applicationId "com.example.android.health" 
     minSdkVersion 15 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 
repositories{ 
    mavenCentral() 
} 
dependencies { 
    // https://mvnrepository.com/artifact/com.facebook.android/facebook-android-sdk 
    compile group: 'com.facebook.android', name: 'facebook-android-sdk', version: '4.26.0' 

    compile fileTree(dir: 'libs', include: ['*.jar']) 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.android.support:appcompat-v7:25.1.1' 
    compile 'com.android.support:design:25.1.1' 
// testCompile 'junit:junit:4.12' 
} 
+1

显示您的* gradle *。 –

+0

加入gradle文件... – rockz

回答

0

下面放线中的build.gradle依赖;

compile 'com.facebook.android:facebook-android-sdk:4.18.0' 
+0

为什么要4.18.0解决这个问题? –

+1

由于*版本* 4.26.0 *已经在* developers facebook *上可用,因此无需更改为* 4.18.0 *。 –

0

而不是这个。

compile group: 'com.facebook.android', name: 'facebook-android-sdk', version: '4.26.0' 

执行此操作。

compile 'com.facebook.android:facebook-android-sdk:4.26.0' 

并确保您有这里面类路径gradle这个

repositories { 
    jcenter { 
     url "http://jcenter.bintray.com/" 
    }  
} 

然后干净重建项目。

相关问题